signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class TextFieldBuilder { /** * Create a search text field .
* @ param textChangeListener
* listener when text is changed .
* @ return the textfield */
public TextField createSearchField ( final TextChangeListener textChangeListener ) { } } | final TextField textField = style ( "filter-box" ) . styleName ( "text-style filter-box-hide" ) . buildTextComponent ( ) ; textField . setWidth ( 100.0F , Unit . PERCENTAGE ) ; textField . addTextChangeListener ( textChangeListener ) ; textField . setTextChangeEventMode ( TextChangeEventMode . LAZY ) ; // 1 seconds timeout .
textField . setTextChangeTimeout ( 1000 ) ; return textField ; |
public class AppUtil { /** * Starts the dialer in order to call a specific phone number . The call has to be manually
* started by the user . If an error occurs while starting the dialer , an { @ link
* ActivityNotFoundException } will be thrown .
* @ param context
* The context , the dialer should be started from , as an instance of the class { @ link
* Context } . The context may not be null
* @ param phoneNumber
* The phone number , which should be dialed , as a { @ link String } . The phone number may
* neither be null , nor empty */
public static void startDialer ( @ NonNull final Context context , @ NonNull final String phoneNumber ) { } } | Condition . INSTANCE . ensureNotNull ( context , "The context may not be null" ) ; Condition . INSTANCE . ensureNotNull ( phoneNumber , "The phone number may not be null" ) ; Condition . INSTANCE . ensureNotEmpty ( phoneNumber , "The phone number may not be empty" ) ; Uri uri = Uri . parse ( phoneNumber . startsWith ( "tel:" ) ? phoneNumber : "tel:" + phoneNumber ) ; Intent intent = new Intent ( Intent . ACTION_DIAL , uri ) ; if ( intent . resolveActivity ( context . getPackageManager ( ) ) == null ) { throw new ActivityNotFoundException ( "Dialer app not available" ) ; } context . startActivity ( intent ) ; |
public class StatementServiceImp { /** * ( non - Javadoc )
* @ see com . popbill . api . StatementService # getChargeInfo ( java . lang . String , int ) */
@ Override public ChargeInfo getChargeInfo ( String CorpNum , int ItemCode ) throws PopbillException { } } | return httpget ( "/Statement/ChargeInfo/" + Integer . toString ( ItemCode ) , CorpNum , null , ChargeInfo . class ) ; |
public class TcpBufferedOutputStream { /** * ( non - Javadoc )
* @ see java . io . FilterOutputStream # write ( byte [ ] , int , int ) */
@ Override public void write ( byte data [ ] , int offset , int len ) throws IOException { } } | if ( ( capacity - size ) < len ) flush ( ) ; // Do we have enough space ?
if ( capacity >= len ) { System . arraycopy ( data , offset , buffer , size , len ) ; size += len ; } else { // Too big , write it directly . . .
out . write ( data , offset , len ) ; } |
public class Kafka { /** * Sets the configuration properties for the Kafka consumer . Resets previously set properties .
* @ param properties The configuration properties for the Kafka consumer . */
public Kafka properties ( Properties properties ) { } } | Preconditions . checkNotNull ( properties ) ; if ( this . kafkaProperties == null ) { this . kafkaProperties = new HashMap < > ( ) ; } this . kafkaProperties . clear ( ) ; properties . forEach ( ( k , v ) -> this . kafkaProperties . put ( ( String ) k , ( String ) v ) ) ; return this ; |
public class PropertySheetTableModel { /** * / * ( non - Javadoc )
* @ see com . l2fprod . common . propertysheet . PropertySheet # setProperties ( com . l2fprod . common . propertysheet . Property [ ] ) */
@ Override public void setProperties ( Property [ ] newProperties ) { } } | // unregister the listeners from previous properties
for ( Property prop : properties ) { prop . removePropertyChangeListener ( this ) ; } // replace the current properties
properties . clear ( ) ; properties . addAll ( Arrays . asList ( newProperties ) ) ; // add listeners
for ( Property prop : properties ) { prop . addPropertyChangeListener ( this ) ; } buildModel ( ) ; |
public class ZipUtils { /** * Attempt to recursively delete a target file .
* Answer null if the delete was successful . Answer the first
* file which could not be deleted if the delete failed .
* If the delete fails , wait 400 MS then try again . Do this
* for the entire delete operation , not for each file deletion .
* A test must be done to verify that the file exists before
* invoking this method : If the file does not exist , the
* delete operation will fail .
* @ param file The file to delete recursively .
* @ return Null if the file was deleted . The first file which
* could not be deleted if the file could not be deleted . */
@ Trivial public static File deleteWithRetry ( File file ) { } } | String methodName = "deleteWithRetry" ; String filePath ; if ( tc . isDebugEnabled ( ) ) { filePath = file . getAbsolutePath ( ) ; Tr . debug ( tc , methodName + ": Recursively delete [ " + filePath + " ]" ) ; } else { filePath = null ; } File firstFailure = delete ( file ) ; if ( firstFailure == null ) { if ( filePath != null ) { Tr . debug ( tc , methodName + ": Successful first delete [ " + filePath + " ]" ) ; } return null ; } if ( filePath != null ) { Tr . debug ( tc , methodName + ": Failed first delete [ " + filePath + " ]: Sleep up to 50 ms and retry" ) ; } // Extract can occur with the server running , and not long after activity
// on the previously extracted archives .
// If the first delete attempt failed , try again , up to a limit based on
// the expected quiesce time of the zip file cache .
File secondFailure = firstFailure ; for ( int tryNo = 0 ; ( secondFailure != null ) && tryNo < RETRY_COUNT ; tryNo ++ ) { try { Thread . sleep ( RETRY_AMOUNT ) ; } catch ( InterruptedException e ) { // FFDC
} secondFailure = delete ( file ) ; } if ( secondFailure == null ) { if ( filePath != null ) { Tr . debug ( tc , methodName + ": Successful first delete [ " + filePath + " ]" ) ; } return null ; } else { if ( filePath != null ) { Tr . debug ( tc , methodName + ": Failed second delete [ " + filePath + " ]" ) ; } return secondFailure ; } |
public class ComputationGraph { /** * Return a copy of the network with the parameters and activations set to use the specified ( floating point ) data type .
* If the existing datatype is the same as the requested dataype , the original network will be returned unchanged .
* Only floating point datatypes ( DOUBLE , FLOAT , HALF ) may be used .
* @ param dataType Datatype to convert the network to
* @ return The network , set to use the specified datatype for the parameters and activations */
public ComputationGraph convertDataType ( @ NonNull DataType dataType ) { } } | Preconditions . checkState ( dataType . isFPType ( ) , "Invalid DataType: %s. Can only convert network to a floating point type" , dataType ) ; if ( dataType == params ( ) . dataType ( ) ) { return this ; } try ( MemoryWorkspace ws = Nd4j . getMemoryManager ( ) . scopeOutOfWorkspaces ( ) ) { INDArray newParams = params ( ) . castTo ( dataType ) ; String jsonConfig = getConfiguration ( ) . toJson ( ) ; ComputationGraphConfiguration newConf = ComputationGraphConfiguration . fromJson ( jsonConfig ) ; newConf . setDataType ( dataType ) ; ComputationGraph newNet = new ComputationGraph ( newConf ) ; newNet . init ( newParams , false ) ; Updater u = getUpdater ( false ) ; if ( u != null && u . getStateViewArray ( ) != null ) { INDArray oldUpdaterState = u . getStateViewArray ( ) ; newNet . getUpdater ( true ) . getStateViewArray ( ) . assign ( oldUpdaterState ) ; } return newNet ; } |
public class Scanner { /** * Perform classpath masking of classfiles . If the same relative classfile path occurs multiple times in the
* classpath , causes the second and subsequent occurrences to be ignored ( removed ) .
* @ param classpathElementOrder
* the classpath element order
* @ param maskLog
* the mask log */
private void maskClassfiles ( final List < ClasspathElement > classpathElementOrder , final LogNode maskLog ) { } } | final Set < String > whitelistedClasspathRelativePathsFound = new HashSet < > ( ) ; for ( int classpathIdx = 0 ; classpathIdx < classpathElementOrder . size ( ) ; classpathIdx ++ ) { final ClasspathElement classpathElement = classpathElementOrder . get ( classpathIdx ) ; classpathElement . maskClassfiles ( classpathIdx , whitelistedClasspathRelativePathsFound , maskLog ) ; } if ( maskLog != null ) { maskLog . addElapsedTime ( ) ; } |
public class WNGlossComparison { /** * Computes the relations with WordNet gloss comparison matcher .
* @ param source gloss of source
* @ param target gloss of target
* @ return synonym or IDK relation */
public char match ( ISense source , ISense target ) { } } | String sSynset = source . getGloss ( ) ; String tSynset = target . getGloss ( ) ; StringTokenizer stSource = new StringTokenizer ( sSynset , " ,.\"'();" ) ; String lemmaS , lemmaT ; int counter = 0 ; while ( stSource . hasMoreTokens ( ) ) { StringTokenizer stTarget = new StringTokenizer ( tSynset , " ,.\"'();" ) ; lemmaS = stSource . nextToken ( ) ; if ( ! meaninglessWords . contains ( lemmaS ) ) while ( stTarget . hasMoreTokens ( ) ) { lemmaT = stTarget . nextToken ( ) ; if ( ! meaninglessWords . contains ( lemmaT ) ) if ( lemmaS . equals ( lemmaT ) ) counter ++ ; } } if ( counter >= threshold ) return IMappingElement . EQUIVALENCE ; else return IMappingElement . IDK ; |
public class XMLUtil { /** * Read an XML file and replies the DOM document .
* @ param stream is the stream to read
* @ return the DOM document red from the { @ code file } .
* @ throws IOException if the stream cannot be read .
* @ throws SAXException if the stream does not contains valid XML data .
* @ throws ParserConfigurationException if the parser cannot be configured . */
public static Document readXML ( InputStream stream ) throws IOException , SAXException , ParserConfigurationException { } } | assert stream != null : AssertMessages . notNullParameter ( ) ; try { final DocumentBuilderFactory factory = DocumentBuilderFactory . newInstance ( ) ; final DocumentBuilder builder = factory . newDocumentBuilder ( ) ; return builder . parse ( stream ) ; } finally { stream . close ( ) ; } |
public class PubSubRealization { /** * ( non - Javadoc )
* @ see com . ibm . ws . sib . processor . impl . interfaces . DestinationHandler # getAllPubSubOutputHandlers ( ) */
public HashMap < SIBUuid8 , PubSubOutputHandler > getAllPubSubOutputHandlers ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getAllPubSubOutputHandlers" ) ; _pubsubOutputHandlerLockManager . lock ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getAllPubSubOutputHandlers" , _pubsubOutputHandlers ) ; return _pubsubOutputHandlers ; |
public class SubCommandMetaGetRO { /** * Gets read - only metadata .
* @ param adminClient An instance of AdminClient points to given cluster
* @ param nodeIds Node ids to fetch read - only metadata from
* @ param storeNames Stores names to fetch read - only metadata from
* @ param metaKeys List of read - only metadata to fetch
* @ throws IOException */
public static void doMetaGetRO ( AdminClient adminClient , Collection < Integer > nodeIds , List < String > storeNames , List < String > metaKeys ) throws IOException { } } | for ( String key : metaKeys ) { System . out . println ( "Metadata: " + key ) ; if ( ! key . equals ( KEY_MAX_VERSION ) && ! key . equals ( KEY_CURRENT_VERSION ) && ! key . equals ( KEY_STORAGE_FORMAT ) ) { System . out . println ( " Invalid read-only metadata key: " + key ) ; } else { for ( Integer nodeId : nodeIds ) { String hostName = adminClient . getAdminClientCluster ( ) . getNodeById ( nodeId ) . getHost ( ) ; System . out . println ( " Node: " + hostName + ":" + nodeId ) ; if ( key . equals ( KEY_MAX_VERSION ) ) { Map < String , Long > mapStoreToROVersion = adminClient . readonlyOps . getROMaxVersion ( nodeId , storeNames ) ; for ( String storeName : mapStoreToROVersion . keySet ( ) ) { System . out . println ( " " + storeName + ":" + mapStoreToROVersion . get ( storeName ) ) ; } } else if ( key . equals ( KEY_CURRENT_VERSION ) ) { Map < String , Long > mapStoreToROVersion = adminClient . readonlyOps . getROCurrentVersion ( nodeId , storeNames ) ; for ( String storeName : mapStoreToROVersion . keySet ( ) ) { System . out . println ( " " + storeName + ":" + mapStoreToROVersion . get ( storeName ) ) ; } } else if ( key . equals ( KEY_STORAGE_FORMAT ) ) { Map < String , String > mapStoreToROFormat = adminClient . readonlyOps . getROStorageFormat ( nodeId , storeNames ) ; for ( String storeName : mapStoreToROFormat . keySet ( ) ) { System . out . println ( " " + storeName + ":" + mapStoreToROFormat . get ( storeName ) ) ; } } } } System . out . println ( ) ; } |
public class DevicesManagementApi { /** * Updates a device & # 39 ; s server properties .
* Updates a device & # 39 ; s server properties .
* @ param did Device ID . ( required )
* @ param deviceProperties Device properties object to be set ( required )
* @ return ApiResponse & lt ; MetadataEnvelope & gt ;
* @ throws ApiException If fail to call the API , e . g . server error or cannot deserialize the response body */
public ApiResponse < MetadataEnvelope > updateServerPropertiesWithHttpInfo ( String did , Object deviceProperties ) throws ApiException { } } | com . squareup . okhttp . Call call = updateServerPropertiesValidateBeforeCall ( did , deviceProperties , null , null ) ; Type localVarReturnType = new TypeToken < MetadataEnvelope > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; |
public class APrcAccDocSave { /** * < p > Process entity request . < / p >
* @ param pAddParam additional param , e . g . return this line ' s
* document in " nextEntity " for farther process
* @ param pRequestData Request Data
* @ param pEntity Entity to process
* @ return Entity processed for farther process or null
* @ throws Exception - an exception */
@ Override public final T process ( final Map < String , Object > pAddParam , final T pEntity , final IRequestData pRequestData ) throws Exception { } } | @ SuppressWarnings ( "unchecked" ) Class < T > entityClass = ( Class < T > ) pEntity . getClass ( ) ; boolean isNew = pEntity . getIsNew ( ) ; makeFirstPrepareForSave ( pAddParam , pEntity , pRequestData ) ; String actionAdd = pRequestData . getParameter ( "actionAdd" ) ; if ( pEntity . getIsNew ( ) ) { if ( pEntity . getReversedId ( ) != null && pEntity . getItsTotal ( ) . doubleValue ( ) >= 0 ) { throw new ExceptionWithCode ( ExceptionWithCode . WRONG_PARAMETER , "Reversed Total must be less than 0! " + pAddParam . get ( "user" ) ) ; } if ( pEntity . getReversedId ( ) == null && pEntity . getItsTotal ( ) . doubleValue ( ) < 0 ) { throw new ExceptionWithCode ( ExceptionWithCode . WRONG_PARAMETER , "Total must be less than 0 only in reversal! " + pAddParam . get ( "user" ) ) ; } String langDef = ( String ) pAddParam . get ( "langDef" ) ; if ( pEntity . getReversedId ( ) != null ) { String descr ; if ( pEntity . getDescription ( ) == null ) { descr = "" ; } else { descr = pEntity . getDescription ( ) ; } pEntity . setDescription ( descr + " " + getSrvI18n ( ) . getMsg ( "reversed_n" , langDef ) + pEntity . getReversedIdDatabaseBirth ( ) + "-" + pEntity . getReversedId ( ) ) ; } getSrvOrm ( ) . insertEntity ( pAddParam , pEntity ) ; pEntity . setIsNew ( false ) ; if ( pEntity . getReversedId ( ) != null ) { T reversed ; if ( pEntity . getIdDatabaseBirth ( ) . equals ( pEntity . getReversedIdDatabaseBirth ( ) ) ) { // both from current database
reversed = getSrvOrm ( ) . retrieveEntityById ( pAddParam , entityClass , pEntity . getReversedId ( ) ) ; } else { // reversing foreign doc
String tblNm = entityClass . getSimpleName ( ) . toUpperCase ( ) ; String whereStr = " where " + tblNm + ".IDBIRTH=" + pEntity . getReversedId ( ) + " and " + tblNm + ".IDDATABASEBIRTH=" + pEntity . getReversedIdDatabaseBirth ( ) ; reversed = getSrvOrm ( ) . retrieveEntityWithConditions ( pAddParam , entityClass , whereStr ) ; } if ( reversed . getReversedId ( ) != null ) { throw new ExceptionWithCode ( ExceptionWithCode . FORBIDDEN , "Attempt to double reverse! " + pAddParam . get ( "user" ) ) ; } String oldDesr = "" ; if ( reversed . getDescription ( ) != null ) { oldDesr = reversed . getDescription ( ) ; } reversed . setDescription ( oldDesr + " " + getSrvI18n ( ) . getMsg ( "reversing_n" , langDef ) + pEntity . getIdDatabaseBirth ( ) + "-" + pEntity . getItsId ( ) ) ; // reversing always new from current DB
reversed . setReversedId ( pEntity . getItsId ( ) ) ; reversed . setReversedIdDatabaseBirth ( pEntity . getIdDatabaseBirth ( ) ) ; getSrvOrm ( ) . updateEntity ( pAddParam , reversed ) ; srvAccEntry . reverseEntries ( pAddParam , pEntity , reversed ) ; } } else { if ( ! pEntity . getIdDatabaseBirth ( ) . equals ( getSrvOrm ( ) . getIdDatabase ( ) ) ) { throw new ExceptionWithCode ( ExceptionWithCode . WRONG_PARAMETER , "can_not_change_foreign_src" ) ; } // Prevent any changes when document has accounting entries :
T oldEntity = getSrvOrm ( ) . retrieveEntityById ( pAddParam , entityClass , pEntity . getItsId ( ) ) ; if ( oldEntity . getHasMadeAccEntries ( ) ) { throw new ExceptionWithCode ( ExceptionWithCode . FORBIDDEN , "Attempt to update accounted document by " + pAddParam . get ( "user" ) ) ; } checkOtherFraudUpdate ( pAddParam , pEntity , pRequestData , oldEntity ) ; // update also before making acc - entries , cause using SQL queries ! ! !
getSrvOrm ( ) . updateEntity ( pAddParam , pEntity ) ; } if ( ! pEntity . getHasMadeAccEntries ( ) && "makeAccEntries" . equals ( actionAdd ) ) { if ( pEntity . getItsTotal ( ) . doubleValue ( ) <= 0 ) { throw new ExceptionWithCode ( ExceptionWithCode . WRONG_PARAMETER , "total_less_or_eq_zero" ) ; } addCheckIsReadyToAccount ( pAddParam , pEntity , pRequestData ) ; // it will set hasMadeAccEntries = true and update this doc :
this . srvAccEntry . makeEntries ( pAddParam , pEntity ) ; } makeOtherEntries ( pAddParam , pEntity , pRequestData , isNew ) ; return pEntity ; |
public class Normalizer2Impl { /** * Recomposes the buffer text starting at recomposeStartIndex
* ( which is in NFD - decomposed and canonically ordered ) ,
* and truncates the buffer contents .
* Note that recomposition never lengthens the text :
* Any character consists of either one or two code units ;
* a composition may contain at most one more code unit than the original starter ,
* while the combining mark that is removed has at least one code unit . */
private void recompose ( ReorderingBuffer buffer , int recomposeStartIndex , boolean onlyContiguous ) { } } | StringBuilder sb = buffer . getStringBuilder ( ) ; int p = recomposeStartIndex ; if ( p == sb . length ( ) ) { return ; } int starter , pRemove ; int compositionsList ; int c , compositeAndFwd ; int norm16 ; int cc , prevCC ; boolean starterIsSupplementary ; // Some of the following variables are not used until we have a forward - combining starter
// and are only initialized now to avoid compiler warnings .
compositionsList = - 1 ; // used as indicator for whether we have a forward - combining starter
starter = - 1 ; starterIsSupplementary = false ; prevCC = 0 ; for ( ; ; ) { c = sb . codePointAt ( p ) ; p += Character . charCount ( c ) ; norm16 = getNorm16 ( c ) ; cc = getCCFromYesOrMaybe ( norm16 ) ; if ( // this character combines backward and
isMaybe ( norm16 ) && // we have seen a starter that combines forward and
compositionsList >= 0 && // the backward - combining character is not blocked
( prevCC < cc || prevCC == 0 ) ) { if ( isJamoVT ( norm16 ) ) { // c is a Jamo V / T , see if we can compose it with the previous character .
if ( c < Hangul . JAMO_T_BASE ) { // c is a Jamo Vowel , compose with previous Jamo L and following Jamo T .
char prev = ( char ) ( sb . charAt ( starter ) - Hangul . JAMO_L_BASE ) ; if ( prev < Hangul . JAMO_L_COUNT ) { pRemove = p - 1 ; char syllable = ( char ) ( Hangul . HANGUL_BASE + ( prev * Hangul . JAMO_V_COUNT + ( c - Hangul . JAMO_V_BASE ) ) * Hangul . JAMO_T_COUNT ) ; char t ; if ( p != sb . length ( ) && ( t = ( char ) ( sb . charAt ( p ) - Hangul . JAMO_T_BASE ) ) < Hangul . JAMO_T_COUNT ) { ++ p ; syllable += t ; // The next character was a Jamo T .
} sb . setCharAt ( starter , syllable ) ; // remove the Jamo V / T
sb . delete ( pRemove , p ) ; p = pRemove ; } } /* * No " else " for Jamo T :
* Since the input is in NFD , there are no Hangul LV syllables that
* a Jamo T could combine with .
* All Jamo Ts are combined above when handling Jamo Vs . */
if ( p == sb . length ( ) ) { break ; } compositionsList = - 1 ; continue ; } else if ( ( compositeAndFwd = combine ( maybeYesCompositions , compositionsList , c ) ) >= 0 ) { // The starter and the combining mark ( c ) do combine .
int composite = compositeAndFwd >> 1 ; // Remove the combining mark .
pRemove = p - Character . charCount ( c ) ; // pRemove & p : start & limit of the combining mark
sb . delete ( pRemove , p ) ; p = pRemove ; // Replace the starter with the composite .
if ( starterIsSupplementary ) { if ( composite > 0xffff ) { // both are supplementary
sb . setCharAt ( starter , UTF16 . getLeadSurrogate ( composite ) ) ; sb . setCharAt ( starter + 1 , UTF16 . getTrailSurrogate ( composite ) ) ; } else { sb . setCharAt ( starter , ( char ) c ) ; sb . deleteCharAt ( starter + 1 ) ; // The composite is shorter than the starter ,
// move the intermediate characters forward one .
starterIsSupplementary = false ; -- p ; } } else if ( composite > 0xffff ) { // The composite is longer than the starter ,
// move the intermediate characters back one .
starterIsSupplementary = true ; sb . setCharAt ( starter , UTF16 . getLeadSurrogate ( composite ) ) ; sb . insert ( starter + 1 , UTF16 . getTrailSurrogate ( composite ) ) ; ++ p ; } else { // both are on the BMP
sb . setCharAt ( starter , ( char ) composite ) ; } // Keep prevCC because we removed the combining mark .
if ( p == sb . length ( ) ) { break ; } // Is the composite a starter that combines forward ?
if ( ( compositeAndFwd & 1 ) != 0 ) { compositionsList = getCompositionsListForComposite ( getNorm16 ( composite ) ) ; } else { compositionsList = - 1 ; } // We combined ; continue with looking for compositions .
continue ; } } // no combination this time
prevCC = cc ; if ( p == sb . length ( ) ) { break ; } // If c did not combine , then check if it is a starter .
if ( cc == 0 ) { // Found a new starter .
if ( ( compositionsList = getCompositionsListForDecompYes ( norm16 ) ) >= 0 ) { // It may combine with something , prepare for it .
if ( c <= 0xffff ) { starterIsSupplementary = false ; starter = p - 1 ; } else { starterIsSupplementary = true ; starter = p - 2 ; } } } else if ( onlyContiguous ) { // FCC : no discontiguous compositions ; any intervening character blocks .
compositionsList = - 1 ; } } buffer . flush ( ) ; |
public class LoggerUtils { /** * 错误
* @ param clazz 类
* @ param message 消息
* @ param values 格式化参数
* @ since 1.0.8 */
public static void error ( Class < ? > clazz , String message , String ... values ) { } } | getLogger ( clazz ) . error ( formatString ( message , values ) ) ; |
public class AssociateVpcCidrBlockRequest { /** * This method is intended for internal use only . Returns the marshaled request configured with additional
* parameters to enable operation dry - run . */
@ Override public Request < AssociateVpcCidrBlockRequest > getDryRunRequest ( ) { } } | Request < AssociateVpcCidrBlockRequest > request = new AssociateVpcCidrBlockRequestMarshaller ( ) . marshall ( this ) ; request . addParameter ( "DryRun" , Boolean . toString ( true ) ) ; return request ; |
public class AmazonECSClient { /** * Lists the services that are running in a specified cluster .
* @ param listServicesRequest
* @ return Result of the ListServices operation returned by the service .
* @ throws ServerException
* These errors are usually caused by a server issue .
* @ throws ClientException
* These errors are usually caused by a client action , such as using an action or resource on behalf of a
* user that doesn ' t have permissions to use the action or resource , or specifying an identifier that is not
* valid .
* @ throws InvalidParameterException
* The specified parameter is invalid . Review the available parameters for the API request .
* @ throws ClusterNotFoundException
* The specified cluster could not be found . You can view your available clusters with < a > ListClusters < / a > .
* Amazon ECS clusters are Region - specific .
* @ sample AmazonECS . ListServices
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / ecs - 2014-11-13 / ListServices " target = " _ top " > AWS API
* Documentation < / a > */
@ Override public ListServicesResult listServices ( ListServicesRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeListServices ( request ) ; |
public class SeaGlassSpinnerUI { /** * This method is called by installUI to get the editor component
* of the < code > JSpinner < / code > . By default it just returns
* < code > JSpinner . getEditor ( ) < / code > . Subclasses can override
* < code > createEditor < / code > to return a component that contains
* the spinner ' s editor or null , if they ' re going to handle adding
* the editor to the < code > JSpinner < / code > in an
* < code > installUI < / code > override .
* Typically this method would be overridden to wrap the editor
* with a container with a custom border , since one can ' t assume
* that the editors border can be set directly .
* The < code > replaceEditor < / code > method is called when the spinners
* editor is changed with < code > JSpinner . setEditor < / code > . If you ' ve
* overriden this method , then you ' ll probably want to override
* < code > replaceEditor < / code > as well .
* @ return the JSpinners editor JComponent , spinner . getEditor ( ) by default
* @ see # installUI
* @ see # replaceEditor
* @ see JSpinner # getEditor */
@ Override protected JComponent createEditor ( ) { } } | JComponent editor = spinner . getEditor ( ) ; editor . setName ( "Spinner.editor" ) ; updateEditorAlignment ( editor ) ; return editor ; |
public class xen_websensevpx_image { /** * Use this API to fetch filtered set of xen _ websensevpx _ image resources .
* set the filter parameter values in filtervalue object . */
public static xen_websensevpx_image [ ] get_filtered ( nitro_service service , filtervalue [ ] filter ) throws Exception { } } | xen_websensevpx_image obj = new xen_websensevpx_image ( ) ; options option = new options ( ) ; option . set_filter ( filter ) ; xen_websensevpx_image [ ] response = ( xen_websensevpx_image [ ] ) obj . getfiltered ( service , option ) ; return response ; |
public class DemonstrationBase { /** * Get input input type for a stream safely */
protected < T extends ImageBase > ImageType < T > getImageType ( int which ) { } } | synchronized ( inputStreams ) { return inputStreams . get ( which ) . imageType ; } |
public class DocxStamperConfiguration { /** * Registers the given ITypeResolver for the given class . The registered ITypeResolver ' s resolve ( ) method will only
* be called with objects of the specified class .
* Note that each type can only be resolved by ONE ITypeResolver implementation . Multiple calls to addTypeResolver ( )
* with the same resolvedType parameter will override earlier calls .
* @ param resolvedType the class whose objects are to be passed to the given ITypeResolver .
* @ param resolver the resolver to resolve objects of the given type .
* @ param < T > the type resolved by the ITypeResolver . */
public < T > DocxStamperConfiguration addTypeResolver ( Class < T > resolvedType , ITypeResolver resolver ) { } } | this . typeResolvers . put ( resolvedType , resolver ) ; return this ; |
public class CmsXmlContentTypeManager { /** * Initializes XML content types managed in this XML content type manager . < p >
* @ param cms an initialized OpenCms user context with " Administrator " role permissions
* @ throws CmsRoleViolationException in case the provided OpenCms user context doea not have " Administrator " role permissions */
public synchronized void initialize ( CmsObject cms ) throws CmsRoleViolationException { } } | if ( OpenCms . getRunLevel ( ) > OpenCms . RUNLEVEL_1_CORE_OBJECT ) { // simple test cases don ' t require this check
OpenCms . getRoleManager ( ) . checkRole ( cms , CmsRole . ROOT_ADMIN ) ; } // initialize the special entity resolver
CmsXmlEntityResolver . initialize ( cms , getSchemaBytes ( ) ) ; if ( CmsLog . INIT . isInfoEnabled ( ) ) { CmsLog . INIT . info ( Messages . get ( ) . getBundle ( ) . key ( Messages . INIT_NUM_ST_INITIALIZED_1 , new Integer ( m_registeredTypes . size ( ) ) ) ) ; } |
public class MtasXMLParser { /** * Recursive collect .
* @ param refId the ref id
* @ param relationKeyMap the relation key map
* @ param maxRecursion the max recursion
* @ return the collection < ? extends string > */
private Collection < ? extends String > recursiveCollect ( String refId , Map < String , SortedSet < String > > relationKeyMap , int maxRecursion ) { } } | Set < String > list = new HashSet < > ( ) ; if ( maxRecursion > 0 && relationKeyMap . containsKey ( refId ) ) { SortedSet < String > subList = relationKeyMap . get ( refId ) ; for ( String subRefId : subList ) { list . add ( subRefId ) ; list . addAll ( recursiveCollect ( subRefId , relationKeyMap , maxRecursion - 1 ) ) ; } } return list ; |
public class IteratorPool { /** * Get an instance of the given object in this pool
* @ return An instance of the given object */
public synchronized DTMIterator getInstance ( ) { } } | // Check if the pool is empty .
if ( m_freeStack . isEmpty ( ) ) { // Create a new object if so .
try { return ( DTMIterator ) m_orig . clone ( ) ; } catch ( Exception ex ) { throw new WrappedRuntimeException ( ex ) ; } } else { // Remove object from end of free pool .
DTMIterator result = ( DTMIterator ) m_freeStack . remove ( m_freeStack . size ( ) - 1 ) ; return result ; } |
public class Drawer { /** * Add a footerDrawerItem at the end
* @ param drawerItem */
public void addStickyFooterItem ( @ NonNull IDrawerItem drawerItem ) { } } | if ( mDrawerBuilder . mStickyDrawerItems == null ) { mDrawerBuilder . mStickyDrawerItems = new ArrayList < > ( ) ; } mDrawerBuilder . mStickyDrawerItems . add ( drawerItem ) ; DrawerUtils . rebuildStickyFooterView ( mDrawerBuilder ) ; |
public class CurrencyQuery { /** * Gets the currency codes , or the regular expression to select codes .
* @ return the query for chaining . */
public Collection < String > getCurrencyCodes ( ) { } } | Collection < String > result = get ( KEY_QUERY_CURRENCY_CODES , Collection . class ) ; if ( result == null ) { return Collections . emptySet ( ) ; } return result ; |
public class JobInProgress { /** * Check whether setup task can be launched for the job .
* Setup task can be launched after the tasks are inited
* and Job is in PREP state
* and if it is not already launched
* or job is not Killed / Failed
* @ return true / false */
private synchronized boolean canLaunchSetupTask ( ) { } } | return ( tasksInited . get ( ) && status . getRunState ( ) == JobStatus . PREP && ! launchedSetup && ! jobKilled && ! jobFailed ) ; |
public class Monetary { /** * Allows to check if a { @ link javax . money . CurrencyUnit } instance is
* defined , i . e . accessible from { @ link # getCurrency ( String , String . . . ) } .
* @ param locale the target { @ link Locale } , not { @ code null } .
* @ param providers the ( optional ) specification of providers to consider .
* @ return { @ code true } if { @ link # getCurrencies ( Locale , String . . . ) } would return a
* result containing a currency with the given code . */
public static boolean isCurrencyAvailable ( Locale locale , String ... providers ) { } } | return Objects . nonNull ( MONETARY_CURRENCIES_SINGLETON_SPI ( ) ) && MONETARY_CURRENCIES_SINGLETON_SPI ( ) . isCurrencyAvailable ( locale , providers ) ; |
public class ElementParametersImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public boolean eIsSet ( int featureID ) { } } | switch ( featureID ) { case BpsimPackage . ELEMENT_PARAMETERS__TIME_PARAMETERS : return timeParameters != null ; case BpsimPackage . ELEMENT_PARAMETERS__CONTROL_PARAMETERS : return controlParameters != null ; case BpsimPackage . ELEMENT_PARAMETERS__RESOURCE_PARAMETERS : return resourceParameters != null ; case BpsimPackage . ELEMENT_PARAMETERS__PRIORITY_PARAMETERS : return priorityParameters != null ; case BpsimPackage . ELEMENT_PARAMETERS__COST_PARAMETERS : return costParameters != null ; case BpsimPackage . ELEMENT_PARAMETERS__PROPERTY_PARAMETERS : return propertyParameters != null ; case BpsimPackage . ELEMENT_PARAMETERS__VENDOR_EXTENSION : return vendorExtension != null && ! vendorExtension . isEmpty ( ) ; case BpsimPackage . ELEMENT_PARAMETERS__ELEMENT_REF : return ELEMENT_REF_EDEFAULT == null ? elementRef != null : ! ELEMENT_REF_EDEFAULT . equals ( elementRef ) ; case BpsimPackage . ELEMENT_PARAMETERS__ID : return ID_EDEFAULT == null ? id != null : ! ID_EDEFAULT . equals ( id ) ; } return super . eIsSet ( featureID ) ; |
public class VdmBuildPathPropertyPage { /** * Creates and returns a new push button with the given label and / or image .
* @ param parent
* parent control
* @ param label
* button label or < code > null < / code >
* @ param image
* image of < code > null < / code >
* @ return a new push button */
public static Button createPushButton ( Composite parent , String label , Image image ) { } } | Button button = new Button ( parent , SWT . PUSH ) ; button . setFont ( parent . getFont ( ) ) ; if ( image != null ) { button . setImage ( image ) ; } if ( label != null ) { button . setText ( label ) ; } GridData gd = new GridData ( ) ; button . setLayoutData ( gd ) ; return button ; |
public class HttpUtils { /** * Reads a line from an HTTP InputStream , using the given buffer for
* temporary storage .
* @ param in stream to read from
* @ param buffer temporary buffer to use
* @ throws IllegalArgumentException if the given InputStream doesn ' t
* support marking
* @ throws LineTooLongException when line is longer than the limit */
public static String readLine ( InputStream in , byte [ ] buffer , int limit ) throws IllegalArgumentException , IOException , LineTooLongException { } } | if ( ! in . markSupported ( ) ) { throw new IllegalArgumentException ( "InputStream doesn't support marking: " + in . getClass ( ) ) ; } String line = null ; int cursor = 0 ; int len = buffer . length ; int count = 0 ; int c ; loop : while ( ( c = in . read ( ) ) >= 0 ) { if ( limit >= 0 && ++ count > limit ) { throw new LineTooLongException ( limit ) ; } switch ( c ) { case '\r' : in . mark ( 1 ) ; if ( in . read ( ) != '\n' ) { in . reset ( ) ; } // fall through
case '\n' : if ( line == null && cursor == 0 ) { return "" ; } break loop ; default : if ( cursor >= len ) { if ( line == null ) { line = new String ( buffer , "8859_1" ) ; } else { line = line . concat ( new String ( buffer , "8859_1" ) ) ; } cursor = 0 ; } buffer [ cursor ++ ] = ( byte ) c ; } } if ( cursor > 0 ) { if ( line == null ) { line = new String ( buffer , 0 , cursor , "8859_1" ) ; } else { line = line . concat ( new String ( buffer , 0 , cursor , "8859_1" ) ) ; } } return line ; |
public class BigFloatStream { /** * Returns a sequential ordered { @ code Stream < BigFloat > } from { @ code startInclusive }
* ( inclusive ) to { @ code endInclusive } ( inclusive ) by an incremental { @ code step } .
* < p > An equivalent sequence of increasing values can be produced
* sequentially using a { @ code for } loop as follows :
* < pre > for ( BigFloat i = startInclusive ; i . isLessThanOrEqual ( endInclusive ) ; i = i . add ( step ) ) {
* < / pre >
* @ param startInclusive the ( inclusive ) initial value
* @ param endInclusive the inclusive upper bound
* @ param step the step between elements
* @ return a sequential { @ code Stream < BigFloat > } */
public static Stream < BigFloat > rangeClosed ( BigFloat startInclusive , BigFloat endInclusive , BigFloat step ) { } } | if ( step . isZero ( ) ) { throw new IllegalArgumentException ( "invalid step: 0" ) ; } if ( endInclusive . subtract ( startInclusive ) . signum ( ) == - step . signum ( ) ) { return Stream . empty ( ) ; } return StreamSupport . stream ( new BigFloatSpliterator ( startInclusive , endInclusive , true , step ) , false ) ; |
public class ListComplianceSummariesRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ListComplianceSummariesRequest listComplianceSummariesRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( listComplianceSummariesRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( listComplianceSummariesRequest . getFilters ( ) , FILTERS_BINDING ) ; protocolMarshaller . marshall ( listComplianceSummariesRequest . getNextToken ( ) , NEXTTOKEN_BINDING ) ; protocolMarshaller . marshall ( listComplianceSummariesRequest . getMaxResults ( ) , MAXRESULTS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class ZWaveController { /** * Handles the response of the SendData request .
* @ param incomingMessage the response message to process . */
private void handleSendDataResponse ( SerialMessage incomingMessage ) { } } | logger . trace ( "Handle Message Send Data Response" ) ; if ( incomingMessage . getMessageBuffer ( ) [ 2 ] != 0x00 ) logger . debug ( "Sent Data successfully placed on stack." ) ; else logger . error ( "Sent Data was not placed on stack due to error." ) ; |
public class ClassDescriptor { /** * Returns the first found autoincrement field
* defined in this class descriptor . Use carefully
* when multiple autoincrement field were defined .
* @ deprecated does not make sense because it ' s possible to
* define more than one autoincrement field . Alternative
* see { @ link # getAutoIncrementFields } */
public FieldDescriptor getAutoIncrementField ( ) { } } | if ( m_autoIncrementField == null ) { FieldDescriptor [ ] fds = getPkFields ( ) ; for ( int i = 0 ; i < fds . length ; i ++ ) { FieldDescriptor fd = fds [ i ] ; if ( fd . isAutoIncrement ( ) ) { m_autoIncrementField = fd ; break ; } } } if ( m_autoIncrementField == null ) { LoggerFactory . getDefaultLogger ( ) . warn ( this . getClass ( ) . getName ( ) + ": " + "Could not find autoincrement attribute for class: " + this . getClassNameOfObject ( ) ) ; } return m_autoIncrementField ; |
public class HtmlTool { /** * Splits the given HTML content into partitions based on the given separator selector . The
* separators are either dropped or joined with before / after depending on the indicated
* separator strategy .
* @ param content
* HTML content to split
* @ param separatorCssSelector
* CSS selector for separators
* @ param separatorStrategy
* strategy to drop or keep separators , one of " after " , " before " or " no "
* @ return a list of HTML partitions split on separator locations .
* @ since 1.0
* @ see # split ( String , String , JoinSeparator ) */
public List < String > split ( String content , String separatorCssSelector , String separatorStrategy ) { } } | JoinSeparator sepStrategy ; if ( "before" . equals ( separatorStrategy ) ) { sepStrategy = JoinSeparator . BEFORE ; } else if ( "after" . equals ( separatorStrategy ) ) { sepStrategy = JoinSeparator . AFTER ; } else { sepStrategy = JoinSeparator . NO ; } return split ( content , separatorCssSelector , sepStrategy ) ; |
public class App { /** * The app ' s data sources .
* @ param dataSources
* The app ' s data sources . */
public void setDataSources ( java . util . Collection < DataSource > dataSources ) { } } | if ( dataSources == null ) { this . dataSources = null ; return ; } this . dataSources = new com . amazonaws . internal . SdkInternalList < DataSource > ( dataSources ) ; |
public class StyleUtils { /** * Create new marker options populated with the feature row style ( icon or style )
* @ param geoPackage GeoPackage
* @ param featureRow feature row
* @ param density display density : { @ link android . util . DisplayMetrics # density }
* @ return marker options populated with the feature style */
public static MarkerOptions createMarkerOptions ( GeoPackage geoPackage , FeatureRow featureRow , float density ) { } } | return createMarkerOptions ( geoPackage , featureRow , density , null ) ; |
public class LargeObjectManager { /** * This deletes a large object .
* @ param oid describing object to delete
* @ throws SQLException on error */
public void delete ( long oid ) throws SQLException { } } | FastpathArg [ ] args = new FastpathArg [ 1 ] ; args [ 0 ] = Fastpath . createOIDArg ( oid ) ; fp . fastpath ( "lo_unlink" , args ) ; |
public class SingleFileObjectStore { /** * Write a byteBuffer . May return before the write completes .
* @ param byteBuffer to be written .
* @ param byteAddress that the buffer is to be was written at .
* @ return int the number of bytes written .
* @ throws ObjectManagerException */
private int writeBuffer ( java . nio . ByteBuffer byteBuffer , long byteAddress ) throws ObjectManagerException { } } | if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , "writeBuffer" , new Object [ ] { new Integer ( byteBuffer . hashCode ( ) ) , new Long ( byteAddress ) } ) ; // Write the bytes .
int bytesWritten = 0 ; try { while ( byteBuffer . hasRemaining ( ) ) { bytesWritten = bytesWritten + storeChannel . write ( byteBuffer , byteAddress + bytesWritten ) ; } // while ( byteBuffer . hasRemaining ( ) ) .
} catch ( java . io . IOException exception ) { // No FFDC Code Needed .
ObjectManager . ffdc . processException ( this , cclass , "writeBuffer" , exception , "1:833:1.39" ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "writeBuffer" ) ; // cannot continue
objectManagerState . requestShutdown ( ) ; throw new PermanentIOException ( this , exception ) ; } // catch .
if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "writeBuffer" , new Object [ ] { new Integer ( bytesWritten ) } ) ; return bytesWritten ; |
public class WebhookDeliveryDao { /** * All the deliveries for the specified CE task . Results are ordered by descending date . */
public List < WebhookDeliveryLiteDto > selectOrderedByCeTaskUuid ( DbSession dbSession , String ceTaskUuid , int offset , int limit ) { } } | return mapper ( dbSession ) . selectOrderedByCeTaskUuid ( ceTaskUuid , new RowBounds ( offset , limit ) ) ; |
public class SurfDescribeOps { /** * Checks to see if the region is contained inside the image . This includes convolution
* kernel . Take in account the orientation of the region .
* @ param X Center of the interest point .
* @ param Y Center of the interest point .
* @ param radiusRegions Radius in pixels of the whole region at a scale of 1
* @ param kernelSize Size of the kernel in pixels at a scale of 1
* @ param scale Scale factor for the region .
* @ param c Cosine of the orientation
* @ param s Sine of the orientation */
public static < T extends ImageGray < T > > boolean isInside ( T ii , double X , double Y , int radiusRegions , int kernelSize , double scale , double c , double s ) { } } | int c_x = ( int ) Math . round ( X ) ; int c_y = ( int ) Math . round ( Y ) ; kernelSize = ( int ) Math . ceil ( kernelSize * scale ) ; int kernelRadius = kernelSize / 2 + ( kernelSize % 2 ) ; // find the radius of the whole area being sampled
int radius = ( int ) Math . ceil ( radiusRegions * scale ) ; // integral image convolutions sample the pixel before the region starts
// which is why the extra minus one is there
int kernelPaddingMinus = radius + kernelRadius + 1 ; int kernelPaddingPlus = radius + kernelRadius ; // take in account the rotation
if ( c != 0 || s != 0 ) { double xx = Math . abs ( c * kernelPaddingMinus - s * kernelPaddingMinus ) ; double yy = Math . abs ( s * kernelPaddingMinus + c * kernelPaddingMinus ) ; double delta = xx > yy ? xx - kernelPaddingMinus : yy - kernelPaddingMinus ; kernelPaddingMinus += ( int ) Math . ceil ( delta ) ; kernelPaddingPlus += ( int ) Math . ceil ( delta ) ; } // compute the new bounds and see if its inside
int x0 = c_x - kernelPaddingMinus ; if ( x0 < 0 ) return false ; int x1 = c_x + kernelPaddingPlus ; if ( x1 >= ii . width ) return false ; int y0 = c_y - kernelPaddingMinus ; if ( y0 < 0 ) return false ; int y1 = c_y + kernelPaddingPlus ; if ( y1 >= ii . height ) return false ; return true ; |
public class BaseField { /** * Read the physical data from a stream file and set this field .
* @ param daIn Input stream to read this field ' s data from .
* @ param bFixedLength If false ( default ) be sure to save the length in the stream .
* @ return boolean Success ? */
public boolean read ( DataInputStream daIn , boolean bFixedLength ) // Fixed length = false
{ } } | try { String string = null ; if ( bFixedLength ) { // HACK Change this to use the system ' s default byte to char encoding
byte [ ] byData = new byte [ this . getMaxLength ( ) ] ; daIn . readFully ( byData , 0 , this . getMaxLength ( ) ) ; // Get the bytes and convert to Char
int iCount ; for ( iCount = 0 ; iCount < this . getMaxLength ( ) ; iCount ++ ) { if ( byData [ iCount ] == 0 ) break ; } string = new String ( byData , 0 , iCount , "8859_1" ) ; } else string = daIn . readUTF ( ) ; if ( string == null ) return false ; int errorCode = this . setString ( string , DBConstants . DONT_DISPLAY , DBConstants . READ_MOVE ) ; return ( errorCode == DBConstants . NORMAL_RETURN ) ; // Success
} catch ( IOException ex ) { ex . printStackTrace ( ) ; return false ; } |
public class CmsContentEditor { /** * Sets all annotated child elements editable . < p >
* @ param element the element
* @ param serverId the editable resource structure id
* @ param editable < code > true < / code > to enable editing
* @ return < code > true < / code > if the element had editable elements */
public static boolean setEditable ( Element element , String serverId , boolean editable ) { } } | I_CmsLayoutBundle . INSTANCE . editorCss ( ) . ensureInjected ( ) ; NodeList < Element > children = CmsDomUtil . querySelectorAll ( FIELD_SELECTOR + ENTITY_ID_SELECTOR_PREFIX + serverId + ENTITY_ID_SELECTOR_SUFFIX , element ) ; if ( children . getLength ( ) > 0 ) { for ( int i = 0 ; i < children . getLength ( ) ; i ++ ) { Element child = children . getItem ( i ) ; if ( editable ) { child . addClassName ( I_CmsLayoutBundle . INSTANCE . editorCss ( ) . inlineEditable ( ) ) ; } else { child . removeClassName ( I_CmsLayoutBundle . INSTANCE . editorCss ( ) . inlineEditable ( ) ) ; } } return true ; } return false ; |
public class RequestPath { /** * Checks if one of the given selectors is present in the current URL request ( at any position ) .
* @ param request Sling request
* @ param expectedSelectors Selectors string to check for .
* @ return true if the selector was found */
@ SuppressWarnings ( "null" ) public static boolean hasAnySelector ( @ NotNull SlingHttpServletRequest request , @ NotNull String @ NotNull . . . expectedSelectors ) { } } | String [ ] selectors = request . getRequestPathInfo ( ) . getSelectors ( ) ; if ( selectors != null && expectedSelectors != null ) { for ( String expectedSelector : expectedSelectors ) { if ( ArrayUtils . contains ( selectors , expectedSelector ) ) { return true ; } } } return false ; |
public class BigtableTableAdminClientWrapper { /** * { @ inheritDoc } */
@ Override public List < String > listTables ( ) { } } | ListTablesRequest requestProto = ListTablesRequest . newBuilder ( ) . setParent ( instanceName . toString ( ) ) . build ( ) ; ListTablesResponse response = delegate . listTables ( requestProto ) ; ImmutableList . Builder < String > tableIdsBuilder = ImmutableList . builder ( ) ; for ( com . google . bigtable . admin . v2 . Table tableProto : response . getTablesList ( ) ) { tableIdsBuilder . add ( instanceName . toTableId ( tableProto . getName ( ) ) ) ; } return tableIdsBuilder . build ( ) ; |
public class HttpNTLMAuthLogicHandler { /** * { @ inheritDoc } */
@ Override public void handleResponse ( final HttpProxyResponse response ) throws ProxyAuthException { } } | if ( step == 0 ) { String challengeResponse = getNTLMHeader ( response ) ; step = 1 ; if ( challengeResponse == null || challengeResponse . length ( ) < 5 ) { // Nothing to handle at this step .
// Just need to send a reply type 1 message in doHandshake ( ) .
return ; } // else there was no step 0 so continue to step 1.
} if ( step == 1 ) { // Header should look like :
// Proxy - Authenticate : NTLM still _ some _ more _ stuff
String challengeResponse = getNTLMHeader ( response ) ; if ( challengeResponse == null || challengeResponse . length ( ) < 5 ) { throw new ProxyAuthException ( "Unexpected error while reading server challenge !" ) ; } try { challengePacket = Base64 . decodeBase64 ( challengeResponse . substring ( 5 ) . getBytes ( proxyIoSession . getCharsetName ( ) ) ) ; } catch ( IOException e ) { throw new ProxyAuthException ( "Unable to decode the base64 encoded NTLM challenge" , e ) ; } step = 2 ; } else { throw new ProxyAuthException ( "Received unexpected response code (" + response . getStatusLine ( ) + ")." ) ; } |
public class OutlierResult { /** * Evaluate given a set of positives and a scoring .
* @ param eval Evaluation measure
* @ return Score */
double evaluateBy ( ScoreEvaluation eval ) { } } | return eval . evaluate ( new DBIDsTest ( DBIDUtil . ensureSet ( scores . getDBIDs ( ) ) ) , new OutlierScoreAdapter ( this ) ) ; |
public class CompositeEntityMapper { /** * Return an object from the column
* @ param cl
* @ return */
Object fromColumn ( K id , com . netflix . astyanax . model . Column < ByteBuffer > c ) { } } | try { // Allocate a new entity
Object entity = clazz . newInstance ( ) ; idMapper . setValue ( entity , id ) ; setEntityFieldsFromColumnName ( entity , c . getRawName ( ) . duplicate ( ) ) ; valueMapper . setField ( entity , c . getByteBufferValue ( ) . duplicate ( ) ) ; return entity ; } catch ( Exception e ) { throw new PersistenceException ( "failed to construct entity" , e ) ; } |
public class DynamicManager { /** * Get a dynamic attribute
* @ param attributeName the attribute name
* @ return The dynamic attribute */
public IAttributeBehavior getAttribute ( final String attributeName ) { } } | AttributeImpl attr = dynamicAttributes . get ( attributeName . toLowerCase ( Locale . ENGLISH ) ) ; if ( attr == null ) return null ; else return attr . getBehavior ( ) ; |
public class ThriftCatalog { /** * Gets the ThriftEnumMetadata for the specified enum class . If the enum class contains a method
* annotated with @ ThriftEnumValue , the value of this method will be used for the encoded thrift
* value ; otherwise the Enum . ordinal ( ) method will be used . */
public < T extends Enum < T > > ThriftEnumMetadata < ? > getThriftEnumMetadata ( Class < ? > enumClass ) { } } | ThriftEnumMetadata < ? > enumMetadata = enums . get ( enumClass ) ; if ( enumMetadata == null ) { enumMetadata = new ThriftEnumMetadataBuilder < > ( ( Class < T > ) enumClass ) . build ( ) ; ThriftEnumMetadata < ? > current = enums . putIfAbsent ( enumClass , enumMetadata ) ; if ( current != null ) { enumMetadata = current ; } } return enumMetadata ; |
public class WebUtilities { /** * Finds a component by its id .
* @ param id the id of the component to search for .
* @ param visibleOnly true if process visible only
* @ return the component and context for the given id , or null if not found . */
public static ComponentWithContext getComponentById ( final String id , final boolean visibleOnly ) { } } | UIContext uic = UIContextHolder . getCurrent ( ) ; WComponent root = uic . getUI ( ) ; ComponentWithContext comp = TreeUtil . getComponentWithContextForId ( root , id , visibleOnly ) ; return comp ; |
public class DecodedBitStreamParser { /** * EXAMPLE
* Encode the fifteen digit numeric string 000213298174000
* Prefix the numeric string with a 1 and set the initial value of
* t = 1 000 213 298 174 000
* Calculate codeword 0
* d0 = 1 000 213 298 174 000 mod 900 = 200
* t = 1 000 213 298 174 000 div 900 = 1 111 348 109 082
* Calculate codeword 1
* d1 = 1 111 348 109 082 mod 900 = 282
* t = 1 111 348 109 082 div 900 = 1 234 831 232
* Calculate codeword 2
* d2 = 1 234 831 232 mod 900 = 632
* t = 1 234 831 232 div 900 = 1 372 034
* Calculate codeword 3
* d3 = 1 372 034 mod 900 = 434
* t = 1 372 034 div 900 = 1 524
* Calculate codeword 4
* d4 = 1 524 mod 900 = 624
* t = 1 524 div 900 = 1
* Calculate codeword 5
* d5 = 1 mod 900 = 1
* t = 1 div 900 = 0
* Codeword sequence is : 1 , 624 , 434 , 632 , 282 , 200
* Decode the above codewords involves
* 1 x 900 power of 5 + 624 x 900 power of 4 + 434 x 900 power of 3 +
* 632 x 900 power of 2 + 282 x 900 power of 1 + 200 x 900 power of 0 = 1000213298174000
* Remove leading 1 = > Result is 000213298174000 */
private static String decodeBase900toBase10 ( int [ ] codewords , int count ) throws FormatException { } } | BigInteger result = BigInteger . ZERO ; for ( int i = 0 ; i < count ; i ++ ) { result = result . add ( EXP900 [ count - i - 1 ] . multiply ( BigInteger . valueOf ( codewords [ i ] ) ) ) ; } String resultString = result . toString ( ) ; if ( resultString . charAt ( 0 ) != '1' ) { throw FormatException . getFormatInstance ( ) ; } return resultString . substring ( 1 ) ; |
public class ClassScaner { /** * 截取文件绝对路径中包名之前的部分
* @ param file 文件
* @ return 包名之前的部分 */
private String subPathBeforePackage ( File file ) { } } | String filePath = file . getAbsolutePath ( ) ; if ( StrUtil . isNotEmpty ( this . packageDirName ) ) { filePath = StrUtil . subBefore ( filePath , this . packageDirName , true ) ; } return StrUtil . addSuffixIfNot ( filePath , File . separator ) ; |
public class IndentPrinter { /** * Prints a string .
* @ param text String to be written */
public void print ( String text ) { } } | try { out . write ( text ) ; } catch ( IOException ioe ) { throw new GroovyRuntimeException ( ioe ) ; } |
public class MtasPreAnalyzedField { /** * ( non - Javadoc )
* @ see org . apache . solr . schema . PreAnalyzedField # init ( org . apache . solr . schema .
* IndexSchema , java . util . Map ) */
@ Override public void init ( IndexSchema schema , Map < String , String > args ) { } } | args . put ( PARSER_IMPL , MtasPreAnalyzedParser . class . getName ( ) ) ; super . init ( schema , args ) ; |
public class RefreshActionProvider { /** * Slightly modified code , from Jake Wharton ' s ABS */
private void showCheatsheet ( Context context , View view ) { } } | final int [ ] screenPos = new int [ 2 ] ; final Rect displayFrame = new Rect ( ) ; view . getLocationOnScreen ( screenPos ) ; view . getWindowVisibleDisplayFrame ( displayFrame ) ; final int width = view . getWidth ( ) ; final int height = view . getHeight ( ) ; final int midy = screenPos [ 1 ] + ( height / 2 ) ; final int screenWidth = context . getResources ( ) . getDisplayMetrics ( ) . widthPixels ; Toast cheatSheet = Toast . makeText ( context , title , Toast . LENGTH_SHORT ) ; if ( midy < displayFrame . height ( ) ) { // Show along the top ; follow action buttons
cheatSheet . setGravity ( Gravity . TOP | Gravity . RIGHT , screenWidth - screenPos [ 0 ] - ( width / 2 ) , height ) ; } else { // Show along the bottom center
cheatSheet . setGravity ( Gravity . BOTTOM | Gravity . CENTER_HORIZONTAL , 0 , height ) ; } cheatSheet . show ( ) ; |
public class ImportClientVpnClientCertificateRevocationListRequest { /** * This method is intended for internal use only . Returns the marshaled request configured with additional
* parameters to enable operation dry - run . */
@ Override public Request < ImportClientVpnClientCertificateRevocationListRequest > getDryRunRequest ( ) { } } | Request < ImportClientVpnClientCertificateRevocationListRequest > request = new ImportClientVpnClientCertificateRevocationListRequestMarshaller ( ) . marshall ( this ) ; request . addParameter ( "DryRun" , Boolean . toString ( true ) ) ; return request ; |
public class HttpClient { /** * Configure URI to use for this request / response
* @ param baseUrl a default base url that can be fully sufficient for request or can
* be used to prepend future { @ link UriConfiguration # uri } calls .
* @ return the appropriate sending or receiving contract */
public final HttpClient baseUrl ( String baseUrl ) { } } | Objects . requireNonNull ( baseUrl , "baseUrl" ) ; return tcpConfiguration ( tcp -> tcp . bootstrap ( b -> HttpClientConfiguration . baseUrl ( b , baseUrl ) ) ) ; |
public class GraphCsvReader { /** * Creates a Graph from CSV input with edge values , but without vertex values .
* @ param vertexKey the type of the vertex IDs
* @ param edgeValue the type of the edge values
* @ return a Graph where the edges are read from an edges CSV file ( with values ) . */
public < K , EV > Graph < K , NullValue , EV > edgeTypes ( Class < K > vertexKey , Class < EV > edgeValue ) { } } | if ( edgeReader == null ) { throw new RuntimeException ( "The edge input file cannot be null!" ) ; } DataSet < Tuple3 < K , K , EV > > edges = edgeReader . types ( vertexKey , vertexKey , edgeValue ) . name ( GraphCsvReader . class . getName ( ) ) ; return Graph . fromTupleDataSet ( edges , executionContext ) ; |
public class HttpUtilities { /** * Retrieve URL without parameters
* @ param sourceURI source URI
* @ return URL without parameters */
public static String getURL ( String sourceURI ) { } } | String retval = sourceURI ; int qPos = sourceURI . indexOf ( "?" ) ; if ( qPos != - 1 ) { retval = retval . substring ( 0 , qPos ) ; } return retval ; |
public class CommunicationManager { /** * Adds torrent to storage with specified { @ link PieceStorageFactory } .
* It can be used for skipping initial validation of data
* @ param dotTorrentFilePath path to torrent metadata file
* @ param downloadDirPath path to directory where downloaded files are placed
* @ param pieceStorageFactory factory for creating { @ link PieceStorage } .
* @ return { @ link TorrentManager } instance for monitoring torrent state
* @ throws IOException if IO error occurs in reading metadata file */
public TorrentManager addTorrent ( String dotTorrentFilePath , String downloadDirPath , PieceStorageFactory pieceStorageFactory ) throws IOException { } } | return addTorrent ( dotTorrentFilePath , downloadDirPath , pieceStorageFactory , Collections . < TorrentListener > emptyList ( ) ) ; |
public class EmptyIfOtherHasValueValidator { /** * { @ inheritDoc } check if given object is valid .
* @ see javax . validation . ConstraintValidator # isValid ( Object ,
* javax . validation . ConstraintValidatorContext ) */
@ Override public final boolean isValid ( final Object pvalue , final ConstraintValidatorContext pcontext ) { } } | if ( pvalue == null ) { return true ; } try { final String fieldCheckValue = BeanPropertyReaderUtil . getNullSaveStringProperty ( pvalue , fieldCheckName ) ; final String fieldCompareValue = BeanPropertyReaderUtil . getNullSaveStringProperty ( pvalue , fieldCompareName ) ; if ( StringUtils . isNotEmpty ( fieldCheckValue ) && StringUtils . equals ( valueCompare , fieldCompareValue ) ) { switchContext ( pcontext ) ; return false ; } return true ; } catch ( final Exception ignore ) { switchContext ( pcontext ) ; return false ; } |
public class AbstractCommonService { /** * 验证数据
* @ param pData
* @ throws APPErrorException */
protected void valid ( Object pData ) throws APPErrorException { } } | if ( pData instanceof TemplateModel ) { TemplateModel entity = ( TemplateModel ) pData ; if ( StringUtil . isNullOrEmpty ( entity . getId ( ) ) ) { throw new APPErrorException ( "无效的主键" ) ; } if ( null == entity . getRev ( ) ) { throw new APPErrorException ( "无效的REV" ) ; } } else if ( pData instanceof CommonModel ) { CommonModel entity = ( CommonModel ) pData ; if ( StringUtil . isNullOrEmpty ( entity . getId ( ) ) ) { throw new APPErrorException ( "无效的主键" ) ; } } |
public class DeleteResourceDefinitionRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DeleteResourceDefinitionRequest deleteResourceDefinitionRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( deleteResourceDefinitionRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( deleteResourceDefinitionRequest . getResourceDefinitionId ( ) , RESOURCEDEFINITIONID_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class HBeanTable { /** * Fetch a set of rows without fetching their references .
* @ param schemaName schema to fetch
* @ param fetchType data to fetch
* @ return rows found */
public Set < HBeanRow > listLazy ( String schemaName , FetchType ... fetchType ) { } } | byte [ ] sid = extractSidPrefix ( schemaName ) ; Scan scan = new Scan ( ) ; HBeanRow . setColumnFilter ( scan , fetchType ) ; FilterList list = new FilterList ( ) ; if ( scan . getFilter ( ) != null ) { list . addFilter ( scan . getFilter ( ) ) ; } list . addFilter ( new PrefixFilter ( sid ) ) ; scan . setFilter ( list ) ; Set < HBeanRow > rows = new HashSet < > ( ) ; ResultScanner scanner = null ; try { scanner = table . getScanner ( scan ) ; for ( Result r : scanner ) { HBeanRow row = new HBeanRow ( r . raw ( ) , uids ) ; rows . add ( row ) ; } } catch ( IOException e ) { throw new RuntimeException ( e ) ; } finally { if ( scanner != null ) { scanner . close ( ) ; } } return rows ; |
public class HldTradeEntitiesProcessorNames { /** * < p > Get thing for given class and thing name . < / p >
* @ param pClass a Class
* @ param pThingName Thing Name
* @ return a thing */
@ Override public final String getFor ( final Class < ? > pClass , final String pThingName ) { } } | if ( "entityEdit" . equals ( pThingName ) && pClass == Cart . class ) { return null ; } else if ( pClass == CustOrder . class ) { if ( "entitySave" . equals ( pThingName ) ) { return PrCuOrSv . class . getSimpleName ( ) ; } else if ( "entityEdit" . equals ( pThingName ) || "entityPrint" . equals ( pThingName ) ) { return PrcEntityRetrieve . class . getSimpleName ( ) ; } return null ; } else if ( "entityEdit" . equals ( pThingName ) || "entityConfirmDelete" . equals ( pThingName ) ) { return getForRetrieveForEditDelete ( pClass ) ; } else if ( "entityCopy" . equals ( pThingName ) ) { return getForCopy ( pClass ) ; } else if ( "entityPrint" . equals ( pThingName ) ) { return getForPrint ( pClass ) ; } else if ( "entitySave" . equals ( pThingName ) ) { return getForSave ( pClass ) ; } else if ( "entityFDelete" . equals ( pThingName ) ) { return getForFDelete ( pClass ) ; } else if ( "entityEFDelete" . equals ( pThingName ) ) { return getForEFDelete ( pClass ) ; } else if ( "entityFSave" . equals ( pThingName ) ) { return getForFSave ( pClass ) ; } else if ( "entityEFSave" . equals ( pThingName ) ) { return getForEFSave ( pClass ) ; } else if ( "entityFolDelete" . equals ( pThingName ) ) { return getForFolDelete ( pClass ) ; } else if ( "entityFolSave" . equals ( pThingName ) ) { return getForFolSave ( pClass ) ; } else if ( "entityDelete" . equals ( pThingName ) ) { return getForDelete ( pClass ) ; } else if ( "entityCreate" . equals ( pThingName ) ) { return getForCreate ( pClass ) ; } return null ; |
public class HttpInboundServiceContextImpl { /** * Retrieve the next buffer of the body asynchronously . This will avoid any
* body modifications , such as decompression or removal of chunked - encoding
* markers .
* If the read can be performed immediately , then a VirtualConnection will be
* returned and the provided callback will not be used . If the read is being
* done asychronously , then null will be returned and the callback used when
* complete . The force input flag allows the caller to force the asynchronous
* read to always occur , and thus the callback to always be used .
* The caller is responsible for releasing these buffers when finished with
* them as the HTTP Channel keeps no reference to them .
* @ param cb
* @ param bForce
* @ return VirtualConnection
* @ throws BodyCompleteException
* - - if the entire body has already been read */
@ Override public VirtualConnection getRawRequestBodyBuffer ( InterChannelCallback cb , boolean bForce ) throws BodyCompleteException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "getRawRequestBodyBuffer(async)" ) ; } setRawBody ( true ) ; VirtualConnection vc = getRequestBodyBuffer ( cb , bForce ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "getRawRequestBodyBuffer(async): " + vc ) ; } return vc ; |
public class ServerWebSocketContainer { /** * Directly invokes an endpoint method , without dispatching to an executor
* @ param invocation The invocation */
public void invokeEndpointMethod ( final Runnable invocation ) { } } | try { invokeEndpointTask . call ( null , invocation ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } |
public class CmsDirectEditButtons { /** * Sets the position . Make sure the widget is attached to the DOM . < p >
* @ param position the absolute position
* @ param buttonsPosition the corrected position for the buttons
* @ param containerElement the parent container element */
public void setPosition ( CmsPositionBean position , CmsPositionBean buttonsPosition , Element containerElement ) { } } | m_position = position ; Element parent = CmsDomUtil . getPositioningParent ( getElement ( ) ) ; Style style = getElement ( ) . getStyle ( ) ; style . setRight ( parent . getOffsetWidth ( ) - ( ( buttonsPosition . getLeft ( ) + buttonsPosition . getWidth ( ) ) - parent . getAbsoluteLeft ( ) ) , Unit . PX ) ; int top = buttonsPosition . getTop ( ) - parent . getAbsoluteTop ( ) ; if ( top < 0 ) { top = 0 ; } style . setTop ( top , Unit . PX ) ; |
public class Caller { /** * This method returns a { @ link Set } of groups loaded for the user during the authentication step .
* Note : Groups are also assumed to be specific to the realm .
* @ return The { @ link Set } of groups loaded during authentication or an empty { @ link Set } if none were loaded . */
public Set < String > getAssociatedGroups ( ) { } } | if ( groups == null ) { if ( securityIdentity != null ) { groups = StreamSupport . stream ( securityIdentity . getRoles ( ) . spliterator ( ) , true ) . collect ( Collectors . toSet ( ) ) ; } else { this . groups = Collections . emptySet ( ) ; } } return groups ; |
public class ProcUrl { /** * { @ inheritDoc } */
@ Override public int findIn ( Source source ) { } } | if ( schemaless ) { return - 1 ; } int start = source . getOffset ( ) ; int sourceLength = source . length ( ) ; int index ; int length = - 1 ; do { index = sourceLength ; // Prepare URL ' s prefixes .
List < String > prefixes = preparePrefixes ( ) ; // Find nearest prefix
for ( String prefix : prefixes ) { int ni = source . findFrom ( start , prefix . toCharArray ( ) , true ) ; if ( ni > 0 && ni < index ) { index = ni ; } } // Try to parse it
if ( index < sourceLength ) { length = parseLength ( source , index , null ) ; if ( length < 0 ) { start = index + 1 ; } } } while ( length < 0 && index < sourceLength ) ; if ( length >= 0 ) { return index ; } else { return - 1 ; } |
public class AbstractCommandInstruction { /** * A shortcut method to create a parsing error with relevant information .
* @ param errorCode an error code
* @ param details ( can be null )
* @ return a new parsing error */
protected ParsingError error ( ErrorCode errorCode , ErrorDetails ... details ) { } } | return new ParsingError ( errorCode , this . context . getCommandFile ( ) , this . line , details ) ; |
public class RemoteTaskRunner { /** * Finds the worker running the task and forwards the shutdown signal to the worker .
* @ param taskId - task id to shutdown */
@ Override public void shutdown ( final String taskId , String reason ) { } } | log . info ( "Shutdown [%s] because: [%s]" , taskId , reason ) ; if ( ! lifecycleLock . awaitStarted ( 1 , TimeUnit . SECONDS ) ) { log . info ( "This TaskRunner is stopped or not yet started. Ignoring shutdown command for task: %s" , taskId ) ; } else if ( pendingTasks . remove ( taskId ) != null ) { pendingTaskPayloads . remove ( taskId ) ; log . info ( "Removed task from pending queue: %s" , taskId ) ; } else if ( completeTasks . containsKey ( taskId ) ) { cleanup ( taskId ) ; } else { final ZkWorker zkWorker = findWorkerRunningTask ( taskId ) ; if ( zkWorker == null ) { log . info ( "Can't shutdown! No worker running task %s" , taskId ) ; return ; } URL url = null ; try { url = TaskRunnerUtils . makeWorkerURL ( zkWorker . getWorker ( ) , "/druid/worker/v1/task/%s/shutdown" , taskId ) ; final StatusResponseHolder response = httpClient . go ( new Request ( HttpMethod . POST , url ) , RESPONSE_HANDLER , shutdownTimeout ) . get ( ) ; log . info ( "Sent shutdown message to worker: %s, status %s, response: %s" , zkWorker . getWorker ( ) . getHost ( ) , response . getStatus ( ) , response . getContent ( ) ) ; if ( ! HttpResponseStatus . OK . equals ( response . getStatus ( ) ) ) { log . error ( "Shutdown failed for %s! Are you sure the task was running?" , taskId ) ; } } catch ( InterruptedException e ) { Thread . currentThread ( ) . interrupt ( ) ; throw new RE ( e , "Interrupted posting shutdown to [%s] for task [%s]" , url , taskId ) ; } catch ( Exception e ) { throw new RE ( e , "Error in handling post to [%s] for task [%s]" , zkWorker . getWorker ( ) . getHost ( ) , taskId ) ; } } |
public class MBeanAccessChecker { /** * Lookup methods */
private boolean matches ( MBeanPolicyConfig pConfig , Arg pArg ) { } } | Set < String > values = pConfig . getValues ( pArg . getType ( ) , pArg . getName ( ) ) ; if ( values == null ) { ObjectName pattern = pConfig . findMatchingMBeanPattern ( pArg . getName ( ) ) ; if ( pattern != null ) { values = pConfig . getValues ( pArg . getType ( ) , pattern ) ; } } return values != null && ( values . contains ( pArg . getValue ( ) ) || wildcardMatch ( values , pArg . getValue ( ) ) ) ; |
public class Solo { /** * Returns an ArrayList of the Views currently displayed in the focused Activity or Dialog .
* @ return an { @ code ArrayList } of the { @ link View } objects currently displayed in the
* focused window */
public ArrayList < View > getCurrentViews ( ) { } } | if ( config . commandLogging ) { Log . d ( config . commandLoggingTag , "getCurrentViews()" ) ; } return viewFetcher . getViews ( null , true ) ; |
public class EvalHelper { /** * JavaBean - spec compliant accessor .
* @ param clazz
* @ param field
* @ return */
public static Method getAccessor ( Class < ? > clazz , String field ) { } } | LOG . trace ( "getAccessor({}, {})" , clazz , field ) ; try { return clazz . getMethod ( "get" + ucFirst ( field ) ) ; } catch ( NoSuchMethodException e ) { try { return clazz . getMethod ( field ) ; } catch ( NoSuchMethodException e1 ) { try { return clazz . getMethod ( "is" + ucFirst ( field ) ) ; } catch ( NoSuchMethodException e2 ) { return null ; } } } |
public class AipImageSearch { /** * 相同图检索 — 入库接口
* * * 该接口实现单张图片入库 , 入库时需要同步提交图片及可关联至本地图库的摘要信息 ( 具体变量为brief , 具体可传入图片在本地标记id 、 图片url 、 图片名称等 ) ; 同时可提交分类维度信息 ( 具体变量为tags , 最多可传入2个tag ) , 方便对图库中的图片进行管理 、 分类检索 。 * * * * 注 : 重复添加完全相同的图片会返回错误 。 * *
* @ param url - 图片完整URL , URL长度不超过1024字节 , URL对应的图片base64编码后大小不超过4M , 最短边至少15px , 最长边最大4096px , 支持jpg / png / bmp格式 , 当image字段存在时url字段失效
* @ param options - 可选参数对象 , key : value都为string类型
* options - options列表 :
* brief 检索时原样带回 , 最长256B 。
* tags 1 - 65535范围内的整数 , tag间以逗号分隔 , 最多2个tag 。 样例 : " 100,11 " ; 检索时可圈定分类维度进行检索
* @ return JSONObject */
public JSONObject sameHqAddUrl ( String url , HashMap < String , String > options ) { } } | AipRequest request = new AipRequest ( ) ; preOperation ( request ) ; request . addBody ( "url" , url ) ; if ( options != null ) { request . addBody ( options ) ; } request . setUri ( ImageSearchConsts . SAME_HQ_ADD ) ; postOperation ( request ) ; return requestServer ( request ) ; |
public class ElementMatchers { /** * Matches any type description that declares a super type that matches the provided matcher .
* @ param matcher The type to be checked for being a super type of the matched type .
* @ param < T > The type of the matched object .
* @ return A matcher that matches any type description that declares a super type that matches the provided matcher . */
public static < T extends TypeDescription > ElementMatcher . Junction < T > hasGenericSuperType ( ElementMatcher < ? super TypeDescription . Generic > matcher ) { } } | return new HasSuperTypeMatcher < T > ( matcher ) ; |
public class Cache { /** * Copies data from one resource to another , possibly replacing the destination
* resource if one exists .
* @ param source
* the name of the source resource .
* @ param destination
* the name of the destination resource
* @ return
* the cache itself , for method chaining . */
public Cache copyAs ( String source , String destination ) throws CacheException { } } | if ( ! Strings . areValid ( source , destination ) ) { logger . error ( "invalid input parameters for copy from '{}' to '{}'" , source , destination ) ; throw new CacheException ( "invalid input parameters (source: '" + source + "', destination: '" + destination + "')" ) ; } try ( InputStream input = storage . retrieve ( source ) ; OutputStream output = storage . store ( destination ) ) { long copied = Streams . copy ( input , output ) ; logger . trace ( "copied {} bytes from '{}' to '{}'" , copied , source , destination ) ; } catch ( IOException e ) { logger . error ( "error copying from '" + source + "' to '" + destination + "'" , e ) ; throw new CacheException ( "error copying from '" + source + "' to '" + destination + "'" , e ) ; } return this ; |
public class Jaguar { /** * Sets the deployment qualifier .
* The deployment qualifier must be specified before Jaguar starts .
* @ param deployment The deployment qualifier components are deployed . */
public static synchronized void deployment ( Class < ? > deployment ) { } } | Preconditions . checkArgument ( deployment != null , "Parameter 'deployment' must not be [" + deployment + "]" ) ; Preconditions . checkArgument ( deployment . getAnnotation ( Deployment . class ) != null , "'deployment' [" + deployment + "] must be annotated with @Deployment" ) ; Jaguar . deployment = deployment ; logger . info ( "Deployment has been set to [" + deployment . getSimpleName ( ) + "]" ) ; |
public class TypeMapper { /** * for tests only */
private < T extends ManagedType > T getJaversManagedType ( String typeName ) { } } | return ( T ) getJaversManagedType ( engine . getClassByTypeName ( typeName ) , ManagedType . class ) ; |
public class DataFactory { /** * This method get a string ( Hexa or ASCII ) from a bit table
* @ param pAnnotation
* annotation data
* @ param pBit
* bit table
* @ return A string */
private static String getString ( final AnnotationData pAnnotation , final BitUtils pBit ) { } } | String obj = null ; if ( pAnnotation . isReadHexa ( ) ) { obj = pBit . getNextHexaString ( pAnnotation . getSize ( ) ) ; } else { obj = pBit . getNextString ( pAnnotation . getSize ( ) ) . trim ( ) ; } return obj ; |
public class AbstractGraphCanvas { /** * Updates the size of the axes , curve and event panel . Recomputes the event
* locations if necessary . */
private void updateChildren ( ) { } } | axesPanel . setSize ( getWidth ( ) , getHeight ( ) ) ; plotPanel . setSize ( getWidth ( ) - X_OFFSET_LEFT - X_OFFSET_RIGHT , getHeight ( ) - Y_OFFSET_BOTTOM - Y_OFFSET_TOP ) ; |
public class MimeType { /** * Return a content type string corresponding to a given file extension suffix .
* If there is no MimeType corresponding to the file extension , then returns the file
* extension string directly .
* @ param fileExtension
* file extension suffix
* @ return
* A content type string corresponding to the file extension suffix
* or the file extension suffix itself if no corresponding mimetype found . */
public static String typeOfSuffix ( String fileExtension ) { } } | MimeType mimeType = indexByFileExtension . get ( fileExtension ) ; return null == mimeType ? fileExtension : mimeType . type ; |
public class HttpRequest { /** * 文件表单项 < br >
* 一旦有文件加入 , 表单变为multipart / form - data
* @ param name 名
* @ param resource 数据源 , 文件可以使用 { @ link FileResource } 包装使用
* @ return this
* @ since 4.0.9 */
public HttpRequest form ( String name , Resource resource ) { } } | if ( null != resource ) { if ( false == isKeepAlive ( ) ) { keepAlive ( true ) ; } if ( null == this . fileForm ) { fileForm = new HashMap < > ( ) ; } // 文件对象
this . fileForm . put ( name , resource ) ; } return this ; |
public class JSPostProcessorChainFactory { /** * ( non - Javadoc )
* @ see
* net . jawr . web . resource . bundle . factory . processor . PostProcessorChainFactory #
* buildDefaultProcessor ( ) */
@ Override public ResourceBundlePostProcessor buildDefaultProcessorChain ( ) { } } | AbstractChainedResourceBundlePostProcessor processor = buildJSMinPostProcessor ( ) ; processor . addNextProcessor ( buildLicensesProcessor ( ) ) ; return processor ; |
public class HttpFactoryConfig { /** * Parse the single larger buffer size that is allowed to reach beyond the
* standard buffer size
* @ param props */
private void parseMsgLargeBuffer ( Map < Object , Object > props ) { } } | if ( ! areMessagesLimited ( ) ) { // if there isn ' t a standard size limit , ignore this extension to
// that config option
return ; } String value = ( String ) props . get ( HttpConfigConstants . PROPNAME_MSG_SIZE_LARGEBUFFER ) ; if ( null != value ) { try { long limit = Long . parseLong ( value ) ; if ( limit < getMessageSize ( ) || HttpConfigConstants . UNLIMITED > limit ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Config: Invalid large buffer limit: " + limit ) ; } limit = getMessageSize ( ) ; } this . msgSizeLargeBuffer = limit ; } catch ( NumberFormatException e ) { // no FFDC required
if ( tc . isEventEnabled ( ) ) { Tr . event ( tc , "Config: Non-numeric large buffer size; " + value ) ; } } } |
public class JdbcCpoXaAdapter { /** * Executes an Object that represents an executable object within the datasource . It is assumed that the object exists
* in the datasource . If the object does not exist , an exception will be thrown
* < pre > Example :
* < code >
* class SomeObject so = new SomeObject ( ) ;
* class SomeResult sr = new SomeResult ( ) ;
* class CpoAdapter cpo = null ;
* try {
* cpo = new JdbcCpoAdapter ( new JdbcDataSourceInfo ( driver , url , user , password , 1,1 , false ) ) ;
* } catch ( CpoException ce ) {
* / / Handle the error
* cpo = null ;
* if ( cpo ! = null ) {
* so . setId ( 1 ) ;
* so . setName ( " SomeName " ) ;
* try {
* sr = ( SomeResult ) cpo . executeObject ( " execNotifyProc " , so , sr ) ;
* } catch ( CpoException ce ) {
* / / Handle the error
* < / code >
* < / pre >
* @ param name The String name of the EXECUTE Function Group that will be used to create the object in the datasource .
* null signifies that the default rules will be used .
* @ param criteria This is an object that has been defined within the metadata of the datasource . If the class is not
* defined an exception will be thrown . If the object does not exist in the datasource , an exception will be thrown .
* This object is used to populate the IN parameters used to retrieve the collection of objects .
* @ param result This is an object that has been defined within the metadata of the datasource . If the class is not
* defined an exception will be thrown . If the object does not exist in the datasource , an exception will be thrown .
* This object defines the object type that will be created , filled with the return data and returned from this
* method .
* @ return An object populated with the out parameters
* @ throws CpoException Thrown if there are errors accessing the datasource */
@ Override public < T , C > T executeObject ( String name , C criteria , T result ) throws CpoException { } } | return getCurrentResource ( ) . executeObject ( name , criteria , result ) ; |
public class CmsResourceUtil { /** * Returns the project state icon path for the given resource . < p >
* Relative to < code > / system / workplace / resources / < / code > . < p >
* @ return the project state icon path for the given resource */
public String getIconPathProjectState ( ) { } } | String iconPath ; if ( getProjectState ( ) == STATE_MODIFIED_IN_CURRENT_PROJECT ) { iconPath = "this.png" ; } else if ( getProjectState ( ) == STATE_MODIFIED_IN_OTHER_PROJECT ) { iconPath = "other.png" ; } else if ( getProjectState ( ) == STATE_LOCKED_FOR_PUBLISHING ) { iconPath = "publish.png" ; } else { // STATE _ UNLOCKED
iconPath = "none.gif" ; } return "explorer/project_" + iconPath ; |
public class AbstractCalculator { /** * Calculate prepared expression .
* For tracking calculation
* @ return
* @ see { @ link # calculate ( ) }
* @ see { @ link # getCalculatedValue ( ) } */
public Num calculate ( ) { } } | unbind ( ) ; prepareForNewCalculation ( ) ; PostfixCalculator pc = convertToPostfix ( ) ; Num cv = pc . calculate ( this , postfix , trackSteps ) ; lastCalculatedValue = cv . clone ( ) ; return cv ; |
public class DateUtils { /** * Parse format { @ link # DATE _ FORMAT } . This method never throws exception .
* @ param s any string
* @ return the date , { @ code null } if parsing error or if parameter is { @ code null }
* @ since 3.0 */
@ CheckForNull public static Date parseDateQuietly ( @ Nullable String s ) { } } | Date date = null ; if ( s != null ) { try { date = parseDate ( s ) ; } catch ( RuntimeException e ) { // ignore
} } return date ; |
public class DbAttribute { public String [ ] get_property_list ( ) { } } | String [ ] array = new String [ size ( ) ] ; for ( int i = 0 ; i < size ( ) ; i ++ ) array [ i ] = datum ( i ) . name ; return array ; |
public class FeatureSpatialDiversity_F32 { /** * Adds the estimated 3D location of a feature . */
public void addPoint ( float x , float y , float z ) { } } | norm . grow ( ) . set ( x / z , y / z ) ; |
public class InternalXbaseParser { /** * InternalXbase . g : 317:1 : ruleXRelationalExpression : ( ( rule _ _ XRelationalExpression _ _ Group _ _ 0 ) ) ; */
public final void ruleXRelationalExpression ( ) throws RecognitionException { } } | int stackSize = keepStackSize ( ) ; try { // InternalXbase . g : 321:2 : ( ( ( rule _ _ XRelationalExpression _ _ Group _ _ 0 ) ) )
// InternalXbase . g : 322:2 : ( ( rule _ _ XRelationalExpression _ _ Group _ _ 0 ) )
{ // InternalXbase . g : 322:2 : ( ( rule _ _ XRelationalExpression _ _ Group _ _ 0 ) )
// InternalXbase . g : 323:3 : ( rule _ _ XRelationalExpression _ _ Group _ _ 0 )
{ if ( state . backtracking == 0 ) { before ( grammarAccess . getXRelationalExpressionAccess ( ) . getGroup ( ) ) ; } // InternalXbase . g : 324:3 : ( rule _ _ XRelationalExpression _ _ Group _ _ 0 )
// InternalXbase . g : 324:4 : rule _ _ XRelationalExpression _ _ Group _ _ 0
{ pushFollow ( FOLLOW_2 ) ; rule__XRelationalExpression__Group__0 ( ) ; state . _fsp -- ; if ( state . failed ) return ; } if ( state . backtracking == 0 ) { after ( grammarAccess . getXRelationalExpressionAccess ( ) . getGroup ( ) ) ; } } } } catch ( RecognitionException re ) { reportError ( re ) ; recover ( input , re ) ; } finally { restoreStackSize ( stackSize ) ; } return ; |
public class DEBBuilder { /** * Add regular file to package .
* @ param source
* @ param target
* @ return
* @ throws IOException */
@ Override public FileBuilder addFile ( Path source , String target ) throws IOException { } } | checkTarget ( target ) ; FileBuilder fb = new FileBuilder ( target , source ) ; fileBuilders . add ( fb ) ; return fb ; |
public class NodeManager { /** * Blacklist a resource on a node .
* @ param nodeName The node name
* @ param resourceType The resource type . */
void blacklistNode ( String nodeName , ResourceType resourceType ) { } } | LOG . info ( "Node " + nodeName + " has been blacklisted for resource " + resourceType ) ; clusterManager . getMetrics ( ) . setBlacklistedNodes ( faultManager . getBlacklistedNodeCount ( ) ) ; deleteAppFromNode ( nodeName , resourceType ) ; |
public class NodeUtil { /** * Replace the child of a var / let / const declaration ( usually a name ) with a new statement .
* Preserves the order of side effects for all the other declaration children .
* @ param declChild The name node to be replaced .
* @ param newStatement The statement to replace with . */
public static void replaceDeclarationChild ( Node declChild , Node newStatement ) { } } | checkArgument ( isNameDeclaration ( declChild . getParent ( ) ) ) ; checkArgument ( null == newStatement . getParent ( ) ) ; Node decl = declChild . getParent ( ) ; Node declParent = decl . getParent ( ) ; if ( decl . hasOneChild ( ) ) { declParent . replaceChild ( decl , newStatement ) ; } else if ( declChild . getNext ( ) == null ) { decl . removeChild ( declChild ) ; declParent . addChildAfter ( newStatement , decl ) ; } else if ( declChild . getPrevious ( ) == null ) { decl . removeChild ( declChild ) ; declParent . addChildBefore ( newStatement , decl ) ; } else { checkState ( decl . hasMoreThanOneChild ( ) ) ; Node newDecl = new Node ( decl . getToken ( ) ) . srcref ( decl ) ; for ( Node after = declChild . getNext ( ) , next ; after != null ; after = next ) { next = after . getNext ( ) ; newDecl . addChildToBack ( after . detach ( ) ) ; } decl . removeChild ( declChild ) ; declParent . addChildAfter ( newStatement , decl ) ; declParent . addChildAfter ( newDecl , newStatement ) ; } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.