signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class GeoCodeStub { /** * { @ inheritDoc } */ @ Override public GeoDocument addDocument ( final GeoDocument document ) { } }
map . put ( document . getName ( ) , ( GeoDocumentStub ) document ) ; return document ;
public class CompensationUtil { /** * we create a separate execution for each compensation handler invocation . */ public static void throwCompensationEvent ( List < EventSubscriptionEntity > eventSubscriptions , ActivityExecution execution , boolean async ) { } }
// first spawn the compensating executions for ( EventSubscriptionEntity eventSubscription : eventSubscriptions ) { // check whether compensating execution is already created // ( which is the case when compensating an embedded subprocess , // where the compensating execution is created when leaving the subprocess // and holds snapshot data ) . ExecutionEntity compensatingExecution = getCompensatingExecution ( eventSubscription ) ; if ( compensatingExecution != null ) { if ( compensatingExecution . getParent ( ) != execution ) { // move the compensating execution under this execution if this is not the case yet compensatingExecution . setParent ( ( PvmExecutionImpl ) execution ) ; } compensatingExecution . setEventScope ( false ) ; } else { compensatingExecution = ( ExecutionEntity ) execution . createExecution ( ) ; eventSubscription . setConfiguration ( compensatingExecution . getId ( ) ) ; } compensatingExecution . setConcurrent ( true ) ; } // signal compensation events in REVERSE order of their ' created ' timestamp Collections . sort ( eventSubscriptions , new Comparator < EventSubscriptionEntity > ( ) { @ Override public int compare ( EventSubscriptionEntity o1 , EventSubscriptionEntity o2 ) { return o2 . getCreated ( ) . compareTo ( o1 . getCreated ( ) ) ; } } ) ; for ( EventSubscriptionEntity compensateEventSubscriptionEntity : eventSubscriptions ) { compensateEventSubscriptionEntity . eventReceived ( null , async ) ; }
public class DefaultFeatureTiles { /** * Draw a LineString * @ param simplifyTolerance * simplify tolerance in meters * @ param boundingBox * bounding box * @ param transform * projection transform * @ param graphics * feature tile graphics * @ param lineString * line string * @ param featureStyle * feature style * @ return true if drawn */ private boolean drawLineString ( double simplifyTolerance , BoundingBox boundingBox , ProjectionTransform transform , FeatureTileGraphics graphics , LineString lineString , FeatureStyle featureStyle ) { } }
Path2D path = getPath ( simplifyTolerance , boundingBox , transform , lineString ) ; return drawLine ( graphics , path , featureStyle ) ;
public class PortalPropertySourcesPlaceholderConfigurer { /** * Override the postProcessing . The default PropertySourcesPlaceholderConfigurer does not inject * local properties into the Environment object . It builds a local list of properties files and * then uses a transient Resolver to resolve the @ Value annotations . That means that you are * unable to get to " local " properties ( eg . portal . properties ) after bean post - processing has * completed unless you are going to re - parse those file . This is similar to what * PropertiesManager does , but it uses all the property files configured , not just * portal . properties . * < p > If we upgrade to spring 4 , there are better / more efficient solutions available . I ' m not * aware of better solutions for spring 3 . x . * @ param beanFactory the bean factory * @ throws BeansException if an error occurs while loading properties or wiring up beans */ @ Override public void postProcessBeanFactory ( ConfigurableListableBeanFactory beanFactory ) throws BeansException { } }
if ( propertyResolver == null ) { try { MutablePropertySources sources = new MutablePropertySources ( ) ; PropertySource < ? > localPropertySource = new PropertiesPropertySource ( EXTENDED_PROPERTIES_SOURCE , mergeProperties ( ) ) ; sources . addLast ( localPropertySource ) ; propertyResolver = new PropertySourcesPropertyResolver ( sources ) ; } catch ( IOException e ) { throw new BeanInitializationException ( "Could not load properties" , e ) ; } } super . postProcessBeanFactory ( beanFactory ) ;
public class AppendJsonTask { /** * + " the default is Boolean . FALSE . " , new LiteralPhrase ( Boolean . FALSE ) ) ; */ public Formula getFormula ( ) { } }
Reagent [ ] reagents = new Reagent [ ] { KEY , VALUE , PARENT , EXPRESSION } ; final Formula rslt = new SimpleFormula ( getClass ( ) , reagents ) ; return rslt ;
public class KeyVaultClientBaseImpl { /** * List certificates in a specified key vault . * The GetCertificates operation returns the set of certificates resources in the specified key vault . This operation requires the certificates / list permission . * @ param vaultBaseUrl The vault name , for example https : / / myvault . vault . azure . net . * @ param maxresults Maximum number of results to return in a page . If not specified the service will return up to 25 results . * @ param includePending Specifies whether to include certificates which are not completely provisioned . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the PagedList & lt ; CertificateItem & gt ; object */ public Observable < Page < CertificateItem > > getCertificatesAsync ( final String vaultBaseUrl , final Integer maxresults , final Boolean includePending ) { } }
return getCertificatesWithServiceResponseAsync ( vaultBaseUrl , maxresults , includePending ) . map ( new Func1 < ServiceResponse < Page < CertificateItem > > , Page < CertificateItem > > ( ) { @ Override public Page < CertificateItem > call ( ServiceResponse < Page < CertificateItem > > response ) { return response . body ( ) ; } } ) ;
public class Utils { /** * Call the class constructor with the given arguments * @ param cls The class * @ param args The arguments * @ return The constructed object */ private static Object callConstructor ( final Class < ? > cls , final Class < ? > [ ] argTypes , final Object [ ] args ) { } }
try { final Constructor < ? > cons = cls . getConstructor ( argTypes ) ; return cons . newInstance ( args ) ; } catch ( final InvocationTargetException e ) { throw getCause ( e ) ; } catch ( final IllegalAccessException | NoSuchMethodException | InstantiationException e ) { throw new IllegalStateException ( e ) ; }
public class MutualExclusion { /** * Request the lock . If it is already locked this method will block until it become unblocked and the lock has been obtained . */ public void lock ( ) { } }
if ( cancel != null ) return ; if ( error != null ) return ; Thread t = Thread . currentThread ( ) ; if ( t == lockingThread ) { lockedTimes ++ ; return ; } BlockedThreadHandler blockedHandler = null ; do { synchronized ( this ) { if ( lockingThread == null ) { lockingThread = t ; lockedTimes = 1 ; return ; } if ( blockedHandler == null ) blockedHandler = Threading . getBlockedThreadHandler ( t ) ; if ( blockedHandler == null ) { try { this . wait ( 0 ) ; } catch ( InterruptedException e ) { /* ignore */ } continue ; } } blockedHandler . blocked ( this , 0 ) ; } while ( true ) ;
public class TextNode { /** * Split this text node into two nodes at the specified string offset . After splitting , this node will contain the * original text up to the offset , and will have a new text node sibling containing the text after the offset . * @ param offset string offset point to split node at . * @ return the newly created text node containing the text after the offset . */ public TextNode splitText ( int offset ) { } }
final String text = coreValue ( ) ; Validate . isTrue ( offset >= 0 , "Split offset must be not be negative" ) ; Validate . isTrue ( offset < text . length ( ) , "Split offset must not be greater than current text length" ) ; String head = text . substring ( 0 , offset ) ; String tail = text . substring ( offset ) ; text ( head ) ; TextNode tailNode = new TextNode ( tail ) ; if ( parent ( ) != null ) parent ( ) . addChildren ( siblingIndex ( ) + 1 , tailNode ) ; return tailNode ;
public class ServerConfig { /** * Sets parameters . * @ param parameters the parameters * @ return the parameters */ public ServerConfig setParameters ( Map < String , String > parameters ) { } }
if ( this . parameters == null ) { this . parameters = new ConcurrentHashMap < String , String > ( ) ; this . parameters . putAll ( parameters ) ; } return this ;
public class JSVariant { /** * Implementation of updateAssociations */ public void updateAssociations ( JMFType type ) { } }
super . updateAssociations ( type ) ; if ( getCaseCount ( ) != ( ( JSVariant ) type ) . getCaseCount ( ) ) throw new IllegalStateException ( ) ; if ( cases != null ) for ( int i = 0 ; i < cases . length ; i ++ ) cases [ i ] . updateAssociations ( ( ( JSVariant ) type ) . getCase ( i ) ) ;
public class ListOrganizationPortfolioAccessResult { /** * Displays information about the organization nodes . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setOrganizationNodes ( java . util . Collection ) } or { @ link # withOrganizationNodes ( java . util . Collection ) } if * you want to override the existing values . * @ param organizationNodes * Displays information about the organization nodes . * @ return Returns a reference to this object so that method calls can be chained together . */ public ListOrganizationPortfolioAccessResult withOrganizationNodes ( OrganizationNode ... organizationNodes ) { } }
if ( this . organizationNodes == null ) { setOrganizationNodes ( new java . util . ArrayList < OrganizationNode > ( organizationNodes . length ) ) ; } for ( OrganizationNode ele : organizationNodes ) { this . organizationNodes . add ( ele ) ; } return this ;
public class ListRecoveryPointsByBackupVaultRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( ListRecoveryPointsByBackupVaultRequest listRecoveryPointsByBackupVaultRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( listRecoveryPointsByBackupVaultRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( listRecoveryPointsByBackupVaultRequest . getBackupVaultName ( ) , BACKUPVAULTNAME_BINDING ) ; protocolMarshaller . marshall ( listRecoveryPointsByBackupVaultRequest . getNextToken ( ) , NEXTTOKEN_BINDING ) ; protocolMarshaller . marshall ( listRecoveryPointsByBackupVaultRequest . getMaxResults ( ) , MAXRESULTS_BINDING ) ; protocolMarshaller . marshall ( listRecoveryPointsByBackupVaultRequest . getByResourceArn ( ) , BYRESOURCEARN_BINDING ) ; protocolMarshaller . marshall ( listRecoveryPointsByBackupVaultRequest . getByResourceType ( ) , BYRESOURCETYPE_BINDING ) ; protocolMarshaller . marshall ( listRecoveryPointsByBackupVaultRequest . getByBackupPlanId ( ) , BYBACKUPPLANID_BINDING ) ; protocolMarshaller . marshall ( listRecoveryPointsByBackupVaultRequest . getByCreatedBefore ( ) , BYCREATEDBEFORE_BINDING ) ; protocolMarshaller . marshall ( listRecoveryPointsByBackupVaultRequest . getByCreatedAfter ( ) , BYCREATEDAFTER_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class CleverTapAPI { /** * Session */ private void setLastRequestTimestamp ( Context context , int ts ) { } }
StorageHelper . putInt ( context , storageKeyWithSuffix ( Constants . KEY_LAST_TS ) , ts ) ;
public class LocalDateRange { /** * Returns a copy of this range with the start date adjusted . * This returns a new instance with the start date altered . * Since { @ code LocalDate } implements { @ code TemporalAdjuster } any * local date can simply be passed in . * For example , to adjust the start to one week earlier : * < pre > * range = range . withStart ( date - & gt ; date . minus ( 1 , ChronoUnit . WEEKS ) ) ; * < / pre > * @ param adjuster the adjuster to use , not null * @ return a copy of this range with the start date adjusted * @ throws DateTimeException if the new start date is after the current end date */ public LocalDateRange withStart ( TemporalAdjuster adjuster ) { } }
return LocalDateRange . of ( start . with ( adjuster ) , end ) ;
public class Objects { /** * Returns int value of argument , if possible , wrapped in Optional * Interprets String as Number */ public static Optional < Integer > toInteger ( Object arg ) { } }
if ( arg instanceof Number ) { return Optional . of ( ( ( Number ) arg ) . intValue ( ) ) ; } else if ( arg instanceof String ) { Optional < ? extends Number > optional = toNumber ( arg ) ; if ( optional . isPresent ( ) ) { return Optional . of ( optional . get ( ) . intValue ( ) ) ; } else { return Optional . empty ( ) ; } } else { return Optional . empty ( ) ; }
public class cspolicylabel_cspolicy_binding { /** * Use this API to count cspolicylabel _ cspolicy _ binding resources configued on NetScaler . */ public static long count ( nitro_service service , String labelname ) throws Exception { } }
cspolicylabel_cspolicy_binding obj = new cspolicylabel_cspolicy_binding ( ) ; obj . set_labelname ( labelname ) ; options option = new options ( ) ; option . set_count ( true ) ; cspolicylabel_cspolicy_binding response [ ] = ( cspolicylabel_cspolicy_binding [ ] ) obj . get_resources ( service , option ) ; if ( response != null ) { return response [ 0 ] . __count ; } return 0 ;
public class ModuleSpaceMemberships { /** * Create a new membership . * This method will override the configuration specified through * { @ link CMAClient . Builder # setSpaceId ( String ) } and will ignore * { @ link CMAClient . Builder # setEnvironmentId ( String ) } . * @ param spaceId the space id to host the membership . * @ param membership the new membership to be created . * @ return the newly created membership . * @ throws IllegalArgumentException if space id is null . * @ throws IllegalArgumentException if membership is null . */ public CMASpaceMembership create ( String spaceId , CMASpaceMembership membership ) { } }
assertNotNull ( spaceId , "spaceId" ) ; assertNotNull ( membership , "membership" ) ; final CMASystem sys = membership . getSystem ( ) ; membership . setSystem ( null ) ; try { return service . create ( spaceId , membership ) . blockingFirst ( ) ; } finally { membership . setSystem ( sys ) ; }
public class CamerasInterface { /** * Returns all the brands of cameras that Flickr knows about . * This method does not require authentication . * @ return List of Brands * @ throws FlickrException */ public List < Brand > getBrands ( ) throws FlickrException { } }
Map < String , Object > parameters = new HashMap < String , Object > ( ) ; parameters . put ( "method" , METHOD_GET_BRANDS ) ; Response response = transportAPI . get ( transportAPI . getPath ( ) , parameters , apiKey , sharedSecret ) ; if ( response . isError ( ) ) { throw new FlickrException ( response . getErrorCode ( ) , response . getErrorMessage ( ) ) ; } List < Brand > lst = new ArrayList < Brand > ( ) ; Element mElement = response . getPayload ( ) ; NodeList brandElements = mElement . getElementsByTagName ( "brand" ) ; for ( int i = 0 ; i < brandElements . getLength ( ) ; i ++ ) { Element brandElement = ( Element ) brandElements . item ( i ) ; Brand brand = new Brand ( ) ; brand . setId ( brandElement . getAttribute ( "id" ) ) ; brand . setName ( brandElement . getAttribute ( "name" ) ) ; lst . add ( brand ) ; } return lst ;
public class ClassUtils { /** * Get setter for the specified property with the specified type . * * @ param targetClass class for which a setter will be returned * @ param propertyName name of the property for which a setter will be returned * @ param type a target setter accepts * @ return setter method for the specified property that accepts specified type if one exists , null otherwise */ static Method getSetter ( Class < ? > targetClass , String propertyName , Class < ? > type ) { } }
if ( targetClass == null ) { return null ; } String setterMethodName = setterName ( propertyName ) ; try { Method setter = targetClass . getMethod ( setterMethodName , type ) ; logger . debug ( "Found public setter {} in class {}" , setterMethodName , setter . getDeclaringClass ( ) . getName ( ) ) ; return setter ; } catch ( NoSuchMethodException e ) { logger . debug ( "Failed to found public setter {} in class {}" , setterMethodName , targetClass . getName ( ) ) ; } while ( targetClass != null ) { try { Method setter = targetClass . getDeclaredMethod ( setterMethodName , type ) ; logger . debug ( "Found setter {} in class {}" , setterMethodName , targetClass . getName ( ) ) ; return setter ; } catch ( NoSuchMethodException e ) { logger . debug ( "Failed to found setter {} in class {}" , setterMethodName , targetClass . getName ( ) ) ; } targetClass = targetClass . getSuperclass ( ) ; } return null ;
public class Response { /** * Gets the values of a named response header field * @ param name the header field ' s name * @ return the header ' s values or null if there is no such header field */ public List < String > getHeaders ( String name ) { } }
Map < String , List < String > > fields = conn . getHeaderFields ( ) ; if ( fields == null ) { return null ; } return fields . get ( name ) ;
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link Boolean } { @ code > } */ @ XmlElementDecl ( namespace = "http://docs.oasis-open.org/ns/cmis/messaging/200908/" , name = "includeAllowableActions" , scope = Query . class ) public JAXBElement < Boolean > createQueryIncludeAllowableActions ( Boolean value ) { } }
return new JAXBElement < Boolean > ( _GetObjectOfLatestVersionIncludeAllowableActions_QNAME , Boolean . class , Query . class , value ) ;
public class DatasourceTemplate { /** * Execute a query that return a single result obtained allowing the current row to be mapped through * the provided { @ link RowMapper } . * @ throws SQLException */ public < T > T queryForObject ( String sql , RowMapper < T > rowMapper ) throws SQLException { } }
return ( T ) query ( sql , rowMapper ) ;
public class ArrayList { /** * Private remove method that skips bounds checking and does not * return the value removed . */ private void fastRemove ( int index ) { } }
modCount ++ ; int numMoved = size - index - 1 ; if ( numMoved > 0 ) System . arraycopy ( elementData , index + 1 , elementData , index , numMoved ) ; elementData [ -- size ] = null ; // clear to let GC do its work
public class SmartsheetBuilder { /** * < p > Build the Smartsheet instance . < / p > * @ return the Smartsheet instance * @ throws IllegalStateException if accessToken isn ' t set yet . */ public Smartsheet build ( ) { } }
if ( baseURI == null ) { baseURI = DEFAULT_BASE_URI ; } if ( accessToken == null ) { accessToken = System . getenv ( "SMARTSHEET_ACCESS_TOKEN" ) ; } SmartsheetImpl smartsheet = new SmartsheetImpl ( baseURI , accessToken , httpClient , jsonSerializer ) ; if ( changeAgent != null ) { smartsheet . setChangeAgent ( changeAgent ) ; } if ( assumedUser != null ) { smartsheet . setAssumedUser ( assumedUser ) ; } if ( maxRetryTimeMillis != null ) { smartsheet . setMaxRetryTimeMillis ( maxRetryTimeMillis ) ; } return smartsheet ;
public class TechnologyTargeting { /** * Sets the operatingSystemTargeting value for this TechnologyTargeting . * @ param operatingSystemTargeting * The operating systems being targeted by the { @ link LineItem } . */ public void setOperatingSystemTargeting ( com . google . api . ads . admanager . axis . v201811 . OperatingSystemTargeting operatingSystemTargeting ) { } }
this . operatingSystemTargeting = operatingSystemTargeting ;
public class HsqlDbms { /** * Close the fast datasource . */ public void closeFastDataSource ( DataSource ds ) throws SQLException { } }
BasicDataSource bds = ( BasicDataSource ) ds ; bds . close ( ) ;
public class ExampleTaggableEntitiesFixturesService { @ Action ( restrictTo = RestrictTo . PROTOTYPING ) @ MemberOrder ( sequence = "20" ) public Object installFixturesAndReturnFirst ( ) { } }
final List < FixtureResult > run = findFixtureScriptFor ( ExampleTaggableEntitiesSetUpFixture . class ) . run ( null ) ; return run . get ( 0 ) . getObject ( ) ;
public class TextField { /** * methods */ public boolean assertSetValue ( String value ) { } }
boolean setted = setValue ( value ) ; assertThat ( setted , is ( true ) ) ; return true ;
public class Pagination { /** * Creates a page view of an iterable adding elements to the collection . * @ param < T > the element type parameter * @ param < C > the collection type parameter * @ param start the index where the page starts * @ param howMany the page size * @ param iterable the iterable to be sliced * @ param collection the output collection * @ return a pair containing the iterator size and the requested page */ public static < T , C extends Collection < T > > Pair < Integer , C > page ( long start , long howMany , Iterable < T > iterable , C collection ) { } }
dbc . precondition ( iterable != null , "cannot call page with a null iterable" ) ; return Pagination . page ( start , howMany , iterable . iterator ( ) , collection ) ;
public class RestoreBackupProcess { /** * Add this data to the backup stream . * @ param strMessage the data to log . */ public void run ( ) { } }
Object objMessage = null ; String [ ] files = this . getFileList ( ) ; if ( files == null ) return ; for ( String strFile : files ) { m_reader = this . getReader ( strFile ) ; try { while ( true ) { objMessage = m_reader . readObject ( ) ; if ( objMessage == null ) break ; // EOF = Done BaseBuffer buffer = new VectorBuffer ( ( Vector ) objMessage , BaseBuffer . PHYSICAL_FIELDS | BaseBuffer . MODIFIED_ONLY ) ; buffer . setHeaderCount ( 3 ) ; String strTrxType = buffer . getHeader ( ) . toString ( ) ; String strTableName = buffer . getHeader ( ) . toString ( ) ; String strKey = buffer . getHeader ( ) . toString ( ) ; try { Record record = this . getRecord ( strTableName ) ; if ( record == null ) { ClassInfo recClassInfo = ( ClassInfo ) this . getMainRecord ( ) ; recClassInfo . addNew ( ) ; recClassInfo . setKeyArea ( ClassInfo . CLASS_NAME_KEY ) ; recClassInfo . getField ( ClassInfo . CLASS_NAME ) . setString ( strTableName ) ; if ( recClassInfo . seek ( DBConstants . EQUALS ) ) { strTableName = recClassInfo . getPackageName ( null ) + '.' + strTableName ; record = Record . makeRecordFromClassName ( strTableName , this ) ; this . disableAllListeners ( record ) ; record . setAutoSequence ( false ) ; } else { if ( ! NOTRX . equalsIgnoreCase ( strTrxType ) ) System . out . println ( "Error - table not found: " + strTableName ) ; continue ; } } record . addNew ( ) ; record . getCounterField ( ) . setString ( strKey ) ; if ( ProxyConstants . ADD . equalsIgnoreCase ( strTrxType ) ) { buffer . bufferToFields ( record , DBConstants . DISPLAY , DBConstants . READ_MOVE ) ; record . add ( ) ; } else if ( ProxyConstants . SET . equalsIgnoreCase ( strTrxType ) ) { if ( record . seek ( DBConstants . EQUALS ) ) { record . edit ( ) ; buffer . bufferToFields ( record , DBConstants . DISPLAY , DBConstants . READ_MOVE ) ; record . set ( ) ; } else System . out . println ( "Error - record not found: " + strTableName + ", key: " + strKey ) ; } else if ( ProxyConstants . REMOVE . equalsIgnoreCase ( strTrxType ) ) { if ( record . seek ( DBConstants . EQUALS ) ) { record . edit ( ) ; record . remove ( ) ; } else System . out . println ( "Error - record not found: " + strTableName + ", key: " + strKey ) ; } } catch ( DBException e ) { e . printStackTrace ( ) ; System . out . println ( "Error - record: " + strTableName + ", key: " + strKey + " trx type: " + strTrxType ) ; } System . out . println ( "trxType: " + strTrxType + " record: " + strTableName + " key: " + strKey ) ; } m_reader . close ( ) ; m_reader = null ; } catch ( EOFException e ) { // Ok - Done } catch ( IOException e ) { e . printStackTrace ( ) ; } catch ( ClassNotFoundException e ) { e . printStackTrace ( ) ; } }
public class BasicDistributionSummary { /** * Updates the statistics kept by the summary with the specified amount . */ public void record ( long amount ) { } }
if ( amount >= 0 ) { totalAmount . increment ( amount ) ; count . increment ( ) ; max . update ( amount ) ; min . update ( amount ) ; }
public class TableUtils { /** * Guava { @ link Function } to transform a cell to its row key . */ public static < R , C , V > Function < Table . Cell < R , C , V > , R > toRowKeyFunction ( ) { } }
return new Function < Table . Cell < R , C , V > , R > ( ) { @ Override public R apply ( final Table . Cell < R , C , V > input ) { return input . getRowKey ( ) ; } } ;
public class QueryBuilder { /** * Set the { @ link FeatureCode } s that will be used to constraint the query results ; replacing any * previously configured IDs . Use the addFeatureCodes ( ) and removeFeatureCodes ( ) methods to * modify the existing configuration . * @ param codes the new set of { @ link FeatureCode } s used to constrain the query results * @ return this */ public QueryBuilder featureCodes ( final Set < FeatureCode > codes ) { } }
featureCodes = EnumSet . noneOf ( FeatureCode . class ) ; if ( codes != null ) { featureCodes . addAll ( codes ) ; } return this ;
public class ScriptableObject { /** * Returns the value of the indexed property or NOT _ FOUND . * @ param index the numeric index for the property * @ param start the object in which the lookup began * @ return the value of the property ( may be null ) , or NOT _ FOUND */ @ Override public Object get ( int index , Scriptable start ) { } }
if ( externalData != null ) { if ( index < externalData . getArrayLength ( ) ) { return externalData . getArrayElement ( index ) ; } return Scriptable . NOT_FOUND ; } Slot slot = slotMap . query ( null , index ) ; if ( slot == null ) { return Scriptable . NOT_FOUND ; } return slot . getValue ( start ) ;
public class TypeExtractor { @ PublicEvolving public static < IN , OUT > TypeInformation < OUT > getMapReturnTypes ( MapFunction < IN , OUT > mapInterface , TypeInformation < IN > inType ) { } }
return getMapReturnTypes ( mapInterface , inType , null , false ) ;
public class SessionContextRegistry { /** * webContainerProperties , Properties sessionManagerProperties ) { */ public void setPropertiesInSMC ( SessionManagerConfig _smc ) { } }
/* * cannot cache whether security is enabled in lWAS * boolean securityEnabled = getWsSecurityEnabled ( ) ; * if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) & & LoggingUtil . SESSION _ LOGGER _ CORE . isLoggable ( Level . FINE ) ) { * LoggingUtil . SESSION _ LOGGER _ CORE . logp ( Level . FINE , methodClassName , " setPropertiesInSMC " , " smcServerSecurity = " + securityEnabled ) ; * _ smc . setServerSecurityEnabled ( securityEnabled ) ; */ /* - The following logic exists on tWAS , but serves no purpose because hideSessionValues = true by default if ( ! SessionManagerConfig . isHideSessionValuesPropertySet ( ) & & securityEnabled ) { / / we still need to hide the session if security is on and prop wasn ' t set SessionManagerConfig . setHideSessionValues ( true ) ; */ if ( _smc . isDebugSessionCrossover ( ) && SessionContext . currentThreadSacHashtable == null ) { SessionContext . currentThreadSacHashtable = new WSThreadLocal ( ) ; }
public class SliderBar { /** * Set the current value and optionally fire the onValueChange event . * @ param curValue * the current value * @ param fireEvent * fire the onValue change event if true */ public void setCurrentValue ( double curValue , boolean fireEvent ) { } }
// Confine the value to the range this . curValue = Math . max ( minValue , Math . min ( maxValue , curValue ) ) ; double remainder = ( this . curValue - minValue ) % stepSize ; this . curValue -= remainder ; // Go to next step if more than halfway there if ( ( remainder > ( stepSize / 2 ) ) && ( ( this . curValue + stepSize ) <= maxValue ) ) { this . curValue += stepSize ; } // Redraw the knob drawKnob ( ) ; // Fire the ValueChangeEvent if ( fireEvent ) { ValueChangeEvent . fire ( this , this . curValue ) ; }
public class WhileyFileParser { /** * Parse a block of zero or more case statements which share the same * indentation level . Their indentation level must be strictly greater than * that of their parent , otherwise the end of block is signalled . The * < i > indentation level < / i > for the block is set by the first statement * encountered ( assuming their is one ) . An error occurs if a subsequent * statement is reached with an indentation level < i > greater < / i > than the * block ' s indentation level . * @ param scope * The enclosing scope for this statement , which determines the * set of visible ( i . e . declared ) variables and also the current * indentation level . * @ return */ private Tuple < Stmt . Case > parseCaseBlock ( EnclosingScope scope ) { } }
// First , determine the initial indentation of this block based on the // first statement ( or null if there is no statement ) . Indent indent = getIndent ( ) ; // We must create a new scope to ensure variables declared within this // block are not visible in the enclosing scope . EnclosingScope caseScope = scope . newEnclosingScope ( indent ) ; // Second , check that this is indeed the initial indentation for this // block ( i . e . that it is strictly greater than parent indent ) . if ( indent == null || indent . lessThanEq ( scope . getIndent ( ) ) ) { // Initial indent either doesn ' t exist or is not strictly greater // than parent indent and , therefore , signals an empty block . return new Tuple < > ( ) ; } else { // Initial indent is valid , so we proceed parsing case statements // with the appropriate level of indent . ArrayList < Stmt . Case > cases = new ArrayList < > ( ) ; Indent nextIndent ; while ( ( nextIndent = getIndent ( ) ) != null && indent . lessThanEq ( nextIndent ) ) { // At this point , nextIndent contains the indent of the current // statement . However , this still may not be equivalent to this // block ' s indentation level . // First , check the indentation matches that for this block . if ( ! indent . equivalent ( nextIndent ) ) { // No , it ' s not equivalent so signal an error . syntaxError ( "unexpected end-of-block" , indent ) ; } // Second , parse the actual case statement at this point ! cases . add ( parseCaseStatement ( caseScope ) ) ; } checkForDuplicateDefault ( cases ) ; checkForDuplicateConditions ( cases ) ; return new Tuple < > ( cases ) ; }
public class AnnotationTypeOptionalMemberWriterImpl { /** * { @ inheritDoc } */ protected Content getNavSummaryLink ( TypeElement typeElement , boolean link ) { } }
if ( link ) { return writer . getHyperLink ( SectionName . ANNOTATION_TYPE_OPTIONAL_ELEMENT_SUMMARY , contents . navAnnotationTypeOptionalMember ) ; } else { return contents . navAnnotationTypeOptionalMember ; }
public class ApiOvhEmailpro { /** * Alter this object properties * REST : PUT / email / pro / { service } / domain / { domainName } / disclaimer * @ param body [ required ] New object properties * @ param service [ required ] The internal name of your pro organization * @ param domainName [ required ] Domain name * API beta */ public void service_domain_domainName_disclaimer_PUT ( String service , String domainName , OvhDisclaimer body ) throws IOException { } }
String qPath = "/email/pro/{service}/domain/{domainName}/disclaimer" ; StringBuilder sb = path ( qPath , service , domainName ) ; exec ( qPath , "PUT" , sb . toString ( ) , body ) ;
public class MergeJoinScan { /** * Moves to the next record . This is where the action is . * If the next RHS record has the same join value , then move to it . * Otherwise , if the next LHS record has the same join value , then * reposition the RHS scan back to the first record having that join value . * Otherwise , repeatedly move the scan having the smallest value until a * common join value is found . When one of the scans runs out of records , * return false . * @ see Scan # next ( ) */ @ Override public boolean next ( ) { } }
boolean hasmore2 = ss2 . next ( ) ; if ( hasmore2 && ss2 . getVal ( fldName2 ) . equals ( joinVal ) ) return true ; boolean hasmore1 = ss1 . next ( ) ; if ( hasmore1 && ss1 . getVal ( fldName1 ) . equals ( joinVal ) ) { ss2 . restorePosition ( ) ; return true ; } while ( hasmore1 && hasmore2 ) { Constant v1 = ss1 . getVal ( fldName1 ) ; Constant v2 = ss2 . getVal ( fldName2 ) ; if ( v1 . compareTo ( v2 ) < 0 ) hasmore1 = ss1 . next ( ) ; else if ( v1 . compareTo ( v2 ) > 0 ) hasmore2 = ss2 . next ( ) ; else { ss2 . savePosition ( ) ; joinVal = ss2 . getVal ( fldName2 ) ; return true ; } } return false ;
public class OpenIDConnectAuthorizer { @ Override public boolean removeStoredCredentials ( ) { } }
if ( ! deleteTokens ( ) ) return false ; IDToken = null ; refreshToken = null ; haveSessionCookie = false ; authURL = null ; return true ;
public class TransformerHandlerImpl { /** * Enables the user of the TransformerHandler to set the * to set the Result for the transformation . * @ param result A Result instance , should not be null . * @ throws IllegalArgumentException if result is invalid for some reason . */ public void setResult ( Result result ) throws IllegalArgumentException { } }
if ( null == result ) throw new IllegalArgumentException ( XSLMessages . createMessage ( XSLTErrorResources . ER_RESULT_NULL , null ) ) ; // " result should not be null " ) ; try { // ContentHandler handler = // m _ transformer . createResultContentHandler ( result ) ; // m _ transformer . setContentHandler ( handler ) ; SerializationHandler xoh = m_transformer . createSerializationHandler ( result ) ; m_transformer . setSerializationHandler ( xoh ) ; } catch ( javax . xml . transform . TransformerException te ) { throw new IllegalArgumentException ( XSLMessages . createMessage ( XSLTErrorResources . ER_RESULT_COULD_NOT_BE_SET , null ) ) ; // " result could not be set " ) ; } m_result = result ;
public class RampImport { /** * Create marshal to a target argument . */ ModuleMarshal marshal ( Class < ? > sourceType ) { } }
ModuleMarshal marshal = _marshalSourceMap . get ( sourceType ) ; if ( marshal == null ) { marshal = marshalImpl ( sourceType ) ; _marshalSourceMap . put ( sourceType , marshal ) ; } return marshal ;
public class MultipartReader { /** * < p > Reads the < code > header - part < / code > of the current < code > encapsulation < / code > . < / p > * < p > Headers are returned verbatim to the input stream , including the trailing < code > CRLF < / code > marker . Parsing is * left to the application . < / p > * @ return The < code > header - part < / code > of the current encapsulation . * @ throws MalformedStreamException if the stream ends unexpecetedly . */ public String readHeaders ( ) throws MalformedStreamException { } }
int i = 0 ; byte b ; // to support multi - byte characters ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; int size = 0 ; while ( i < HEADER_SEPARATOR . length ) { try { b = readByte ( ) ; } catch ( IOException e ) { throw new MalformedStreamException ( "Stream ended unexpectedly" ) ; } if ( ++ size > HEADER_PART_SIZE_MAX ) { throw new MalformedStreamException ( "Header section has more than " + HEADER_PART_SIZE_MAX + " bytes (maybe it is not properly terminated)" ) ; } if ( b == HEADER_SEPARATOR [ i ] ) { i ++ ; } else { i = 0 ; } baos . write ( b ) ; } String headers = null ; if ( headerEncoding != null ) { try { headers = baos . toString ( headerEncoding ) ; } catch ( UnsupportedEncodingException e ) { // fall back to platform default if specified encoding is not supported . headers = baos . toString ( ) ; } } else { headers = baos . toString ( ) ; } return headers ;
public class Utils { /** * Returns the timezone to display in the event info , if the local timezone is different * from the event timezone . Otherwise returns null . */ public static String getDisplayedTimezone ( long startMillis , String localTimezone , String eventTimezone ) { } }
String tzDisplay = null ; if ( ! TextUtils . equals ( localTimezone , eventTimezone ) ) { // Figure out if this is in DST TimeZone tz = TimeZone . getTimeZone ( localTimezone ) ; if ( tz == null || tz . getID ( ) . equals ( "GMT" ) ) { tzDisplay = localTimezone ; } else { Time startTime = new Time ( localTimezone ) ; startTime . set ( startMillis ) ; tzDisplay = tz . getDisplayName ( startTime . isDst != 0 , TimeZone . SHORT ) ; } } return tzDisplay ;
public class WebFragmentDescriptorImpl { /** * Creates for all String objects representing < code > description < / code > elements , * a new < code > description < / code > element * @ param values list of < code > description < / code > objects * @ return the current instance of < code > WebFragmentDescriptor < / code > */ public WebFragmentDescriptor description ( String ... values ) { } }
if ( values != null ) { for ( String name : values ) { model . createChild ( "description" ) . text ( name ) ; } } return this ;
public class BasicStopwatch { /** * Returns the duration in nanoseconds . No checks are performed to ensure that the stopwatch * has been properly started and stopped before executing this method . If called before stop * it will return the current duration . */ @ Override public long getDuration ( ) { } }
final long end = running . get ( ) ? System . nanoTime ( ) : endTime . get ( ) ; return end - startTime . get ( ) ;
public class ListBundlesResult { /** * A list of bundles . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setBundleList ( java . util . Collection ) } or { @ link # withBundleList ( java . util . Collection ) } if you want to * override the existing values . * @ param bundleList * A list of bundles . * @ return Returns a reference to this object so that method calls can be chained together . */ public ListBundlesResult withBundleList ( BundleDetails ... bundleList ) { } }
if ( this . bundleList == null ) { setBundleList ( new java . util . ArrayList < BundleDetails > ( bundleList . length ) ) ; } for ( BundleDetails ele : bundleList ) { this . bundleList . add ( ele ) ; } return this ;
public class LineInput { public void destroy ( ) { } }
ByteArrayPool . returnByteArray ( _buf ) ; _byteBuffer = null ; _reader = null ; _lineBuffer = null ; _encoding = null ;
public class QueryResponseDeserializer { /** * Method to add custom deserializer for CustomFieldDefinition * @ param objectMapper the Jackson object mapper */ private void registerModulesForCustomFieldDef ( ObjectMapper objectMapper ) { } }
SimpleModule simpleModule = new SimpleModule ( "CustomFieldDefinition" , new Version ( 1 , 0 , 0 , null ) ) ; simpleModule . addDeserializer ( CustomFieldDefinition . class , new CustomFieldDefinitionDeserializer ( ) ) ; objectMapper . registerModule ( simpleModule ) ;
public class Content { /** * Sets the importDateTime value for this Content . * @ param importDateTime * The date and time at which this content was published . This * attribute is read - only . */ public void setImportDateTime ( com . google . api . ads . admanager . axis . v201805 . DateTime importDateTime ) { } }
this . importDateTime = importDateTime ;
public class ActionsConfig { /** * Export the action . * @ param node The xml node ( must not be < code > null < / code > ) . * @ param action The action to export ( must not be < code > null < / code > ) . * @ throws LionEngineException If unable to write node . */ private static void exports ( Xml node , ActionRef action ) { } }
final Xml nodeAction = node . createChild ( NODE_ACTION ) ; nodeAction . writeString ( ATT_PATH , action . getPath ( ) ) ; for ( final ActionRef ref : action . getRefs ( ) ) { exports ( nodeAction , ref ) ; }
public class Seam2Processor { /** * Lookup Seam integration resource loader . * @ return the Seam integration resource loader * @ throws DeploymentUnitProcessingException for any error */ protected synchronized ResourceRoot getSeamIntResourceRoot ( ) throws DeploymentUnitProcessingException { } }
try { if ( seamIntResourceRoot == null ) { final ModuleLoader moduleLoader = Module . getBootModuleLoader ( ) ; Module extModule = moduleLoader . loadModule ( EXT_CONTENT_MODULE ) ; URL url = extModule . getExportedResource ( SEAM_INT_JAR ) ; if ( url == null ) throw ServerLogger . ROOT_LOGGER . noSeamIntegrationJarPresent ( extModule ) ; File file = new File ( url . toURI ( ) ) ; VirtualFile vf = VFS . getChild ( file . toURI ( ) ) ; final Closeable mountHandle = VFS . mountZip ( file , vf , TempFileProviderService . provider ( ) ) ; Service < Closeable > mountHandleService = new Service < Closeable > ( ) { public void start ( StartContext startContext ) throws StartException { } public void stop ( StopContext stopContext ) { VFSUtils . safeClose ( mountHandle ) ; } public Closeable getValue ( ) throws IllegalStateException , IllegalArgumentException { return mountHandle ; } } ; ServiceBuilder < Closeable > builder = serviceTarget . addService ( ServiceName . JBOSS . append ( SEAM_INT_JAR ) , mountHandleService ) ; builder . setInitialMode ( ServiceController . Mode . ACTIVE ) . install ( ) ; serviceTarget = null ; // our cleanup service install work is done MountHandle dummy = MountHandle . create ( null ) ; // actual close is done by the MSC service above seamIntResourceRoot = new ResourceRoot ( vf , dummy ) ; } return seamIntResourceRoot ; } catch ( Exception e ) { throw new DeploymentUnitProcessingException ( e ) ; }
public class Vertex { /** * 创建一个数词实例 * @ param realWord 数字对应的真实字串 * @ return 数词顶点 */ public static Vertex newNumberInstance ( String realWord ) { } }
return new Vertex ( Predefine . TAG_NUMBER , realWord , new CoreDictionary . Attribute ( Nature . m , 1000 ) ) ;
public class Apptentive { /** * Sends a file to the server . This file will be visible in the conversation view on the server , but will not be shown * in the client ' s Message Center . A local copy of this file will be made until the message is transmitted , at which * point the temporary file will be deleted . * @ param content A byte array of the file contents . * @ param mimeType The mime type of the file . */ public static void sendAttachmentFile ( final byte [ ] content , final String mimeType ) { } }
dispatchConversationTask ( new ConversationDispatchTask ( ) { @ Override protected boolean execute ( Conversation conversation ) { ByteArrayInputStream is = null ; try { is = new ByteArrayInputStream ( content ) ; sendAttachmentFile ( is , mimeType ) ; } finally { Util . ensureClosed ( is ) ; } return true ; } } , "send attachment file" ) ;
public class MessageHistory { /** * Retrieves messages from Discord that were sent before the oldest sent message in MessageHistory ' s history cache * ( { @ link # getRetrievedHistory ( ) } ) . * < br > Can only retrieve a < b > maximum < / b > of { @ code 100 } messages at a time . * < br > This method has 2 modes of operation : initial retrieval and additional retrieval . * < ul > * < li > < b > Initial Retrieval < / b > * < br > This mode is what is used when no { @ link net . dv8tion . jda . core . entities . Message Messages } have been retrieved * yet ( { @ link # getRetrievedHistory ( ) } ' s size is 0 ) . Initial retrieval starts from the most recent message sent * to the channel and retrieves backwards from there . So , if 50 messages are retrieved during this mode , the * most recent 50 messages will be retrieved . < / li > * < li > < b > Additional Retrieval < / b > * < br > This mode is used once some { @ link net . dv8tion . jda . core . entities . Message Messages } have already been retrieved * from Discord and are stored in MessageHistory ' s history ( { @ link # getRetrievedHistory ( ) } ) . When retrieving * messages in this mode , MessageHistory will retrieve previous messages starting from the oldest message * stored in MessageHistory . * < br > E . g : If you initially retrieved 10 messages , the next call to this method to retrieve 10 messages would * retrieve the < i > next < / i > 10 messages , starting from the oldest message of the 10 previously retrieved messages . < / li > * < / ul > * Possible { @ link net . dv8tion . jda . core . requests . ErrorResponse ErrorResponses } include : * < ul > * < li > { @ link net . dv8tion . jda . core . requests . ErrorResponse # UNKNOWN _ MESSAGE UNKNOWN _ MESSAGE } * < br > Can occur if retrieving in Additional Mode and the Message being used as the marker for the last retrieved * Message was deleted . Currently , to fix this , you need to create a new * { @ link net . dv8tion . jda . core . entities . MessageHistory MessageHistory } instance . < / li > * < li > { @ link net . dv8tion . jda . core . requests . ErrorResponse # MISSING _ ACCESS MISSING _ ACCESS } * < br > Can occur if the request for history retrieval was executed < i > after < / i > JDA lost access to the Channel , * typically due to the account being removed from the { @ link net . dv8tion . jda . core . entities . Guild Guild } or * { @ link net . dv8tion . jda . client . entities . Group Group } . < / li > * < li > { @ link net . dv8tion . jda . core . requests . ErrorResponse # MISSING _ PERMISSIONS MISSING _ PERMISSIONS } * < br > Can occur if the request for history retrieval was executed < i > after < / i > JDA lost the * { @ link net . dv8tion . jda . core . Permission # MESSAGE _ HISTORY } permission . < / li > * < li > { @ link net . dv8tion . jda . core . requests . ErrorResponse # UNKNOWN _ CHANNEL UNKNOWN _ CHANNEL } * < br > The send request was attempted after the channel was deleted . < / li > * < / ul > * @ param amount * The amount of { @ link net . dv8tion . jda . core . entities . Message Messages } to retrieve . * @ throws java . lang . IllegalArgumentException * The the { @ code amount } is less than { @ code 1 } or greater than { @ code 100 } . * @ return { @ link net . dv8tion . jda . core . requests . RestAction RestAction } - * Type : { @ link java . util . List List } { @ literal < } { @ link net . dv8tion . jda . core . entities . Message Message } { @ literal > } * < br > Retrieved Messages are placed in a List and provided in order of most recent to oldest with most recent * starting at index 0 . If the list is empty , there were no more messages left to retrieve . */ @ CheckReturnValue public RestAction < List < Message > > retrievePast ( int amount ) { } }
if ( amount > 100 || amount < 1 ) throw new IllegalArgumentException ( "Message retrieval limit is between 1 and 100 messages. No more, no less. Limit provided: " + amount ) ; Route . CompiledRoute route = Route . Messages . GET_MESSAGE_HISTORY . compile ( channel . getId ( ) ) . withQueryParams ( "limit" , Integer . toString ( amount ) ) ; if ( ! history . isEmpty ( ) ) route = route . withQueryParams ( "before" , String . valueOf ( history . lastKey ( ) ) ) ; return new RestAction < List < Message > > ( getJDA ( ) , route ) { @ Override protected void handleResponse ( Response response , Request < List < Message > > request ) { if ( ! response . isOk ( ) ) { request . onFailure ( response ) ; return ; } EntityBuilder builder = api . get ( ) . getEntityBuilder ( ) ; LinkedList < Message > msgs = new LinkedList < > ( ) ; JSONArray historyJson = response . getArray ( ) ; for ( int i = 0 ; i < historyJson . length ( ) ; i ++ ) msgs . add ( builder . createMessage ( historyJson . getJSONObject ( i ) ) ) ; msgs . forEach ( msg -> history . put ( msg . getIdLong ( ) , msg ) ) ; request . onSuccess ( msgs ) ; } } ;
public class XmlUtil { /** * 将String类型的XML转换为XML文档 * @ param xmlStr XML字符串 * @ return XML文档 */ public static Document parseXml ( String xmlStr ) { } }
if ( StrUtil . isBlank ( xmlStr ) ) { throw new IllegalArgumentException ( "XML content string is empty !" ) ; } xmlStr = cleanInvalid ( xmlStr ) ; return readXML ( new InputSource ( StrUtil . getReader ( xmlStr ) ) ) ;
public class BeanUtils { /** * 获得输入对象的两层镜象实例 , 要求参数类必需包含一个无参的public构造函数 * 两层镜像 : 如果输入对象的某个属性是系统的实体或实体的集合则clone该实体或集合里面的每个实体 , 且只是两层clone不会再次嵌套 * 实体 : com . baidu . dsp . * . * . java 实体集合 : 目前支持的集合为ArrayList HashSet * @ param source * @ return * @ author guojichun * @ since 1.0.0 */ @ SuppressWarnings ( { } }
"rawtypes" , "unchecked" } ) public static Object getClone ( Object source ) { if ( null == source ) { return null ; } Object target = BeanUtils . getOneLayerClone ( source ) ; try { // 此处使用了JAVA的内省机制 ( 内省是 Java 语言对 Bean 类属性 、 事件的一种缺省处理方法 ) // 获得对像的BeanInfo 信息 : BeanInfo bi = Introspector . getBeanInfo ( source . getClass ( ) ) ; // 获得属性的描述器 PropertyDescriptor [ ] props = bi . getPropertyDescriptors ( ) ; for ( int i = 0 ; i < props . length ; ++ i ) { if ( null != props [ i ] . getReadMethod ( ) ) { Class propertyType = props [ i ] . getPropertyType ( ) ; if ( propertyType . equals ( List . class ) ) { List newList = new ArrayList ( ) ; // 此处使用了JAVA的反射机制通过获得方法的引用去执行方法 , 其中source : 为要执行的方法所属的对象 , // 方法如果没有参数第二个参数则为null ; List valueList = ( List ) props [ i ] . getReadMethod ( ) . invoke ( source ) ; if ( valueList == null ) { valueList = new ArrayList ( ) ; } for ( Object value : valueList ) { Object cloneValue = null ; if ( value . getClass ( ) . getName ( ) . indexOf ( ENTITY_CLASS_PACKAGE ) >= 0 ) { cloneValue = BeanUtils . getOneLayerClone ( value ) ; } else { cloneValue = value ; } newList . add ( cloneValue ) ; } props [ i ] . getWriteMethod ( ) . invoke ( target , newList ) ; } if ( propertyType . equals ( Set . class ) ) { Set newSet = new HashSet ( ) ; Set valueSet = ( Set ) props [ i ] . getReadMethod ( ) . invoke ( source ) ; if ( valueSet == null ) { valueSet = new HashSet ( ) ; } for ( Object value : valueSet ) { Object cloneValue = BeanUtils . getOneLayerClone ( value ) ; newSet . add ( cloneValue ) ; } props [ i ] . getWriteMethod ( ) . invoke ( target , newSet ) ; } else { // 如果是array 跳过 / / FIXME if ( propertyType . equals ( Arrays . class ) ) { continue ; } if ( propertyType . toString ( ) . startsWith ( ENTITY_CLASS_PACKAGE ) ) { Object value = props [ i ] . getReadMethod ( ) . invoke ( source ) ; Object cloneValue = BeanUtils . getOneLayerClone ( value ) ; props [ i ] . getWriteMethod ( ) . invoke ( target , cloneValue ) ; } } } } } catch ( Exception e ) { logger . error ( "clone object exception object class:" + source . getClass ( ) , e ) ; } return target ;
public class PaperParcelWriter { /** * Returns a comma - separated { @ link CodeBlock } for all of the constructor parameter * { @ code dependencies } of an adapter . */ private CodeBlock getAdapterParameterList ( ConstructorInfo constructorInfo ) { } }
List < CodeBlock > blocks = new ArrayList < > ( ) ; for ( ConstructorInfo . Param param : constructorInfo . constructorParameters ( ) ) { if ( param instanceof ConstructorInfo . AdapterParam ) { ConstructorInfo . AdapterParam adapterParam = ( ConstructorInfo . AdapterParam ) param ; if ( adapterParam . adapter . nullSafe ( ) ) { blocks . add ( adapterInstance ( adapterParam . adapter ) ) ; } else { blocks . add ( CodeBlock . of ( "$T.nullSafeClone($L)" , UTILS , adapterInstance ( adapterParam . adapter ) ) ) ; } } else if ( param instanceof ConstructorInfo . ClassParam ) { ConstructorInfo . ClassParam classParam = ( ConstructorInfo . ClassParam ) param ; if ( classParam . className instanceof ParameterizedTypeName ) { ParameterizedTypeName parameterizedName = ( ParameterizedTypeName ) classParam . className ; blocks . add ( CodeBlock . of ( "($1T<$2T>)($1T<?>) $3T.class" , Class . class , parameterizedName , parameterizedName . rawType ) ) ; } else { blocks . add ( CodeBlock . of ( "$T.class" , classParam . className ) ) ; } } else if ( param instanceof ConstructorInfo . CreatorParam ) { ConstructorInfo . CreatorParam creatorParam = ( ConstructorInfo . CreatorParam ) param ; if ( creatorParam . creatorOwner == null ) { blocks . add ( CodeBlock . of ( "null" ) ) ; } else if ( creatorParam . requiresCast ) { ClassName creator = ClassName . get ( "android.os" , "Parcelable" , "Creator" ) ; blocks . add ( CodeBlock . of ( "($T) $T.$N" , creator , creatorParam . creatorOwner , "CREATOR" ) ) ; } else { blocks . add ( CodeBlock . of ( "$T.$N" , creatorParam . creatorOwner , "CREATOR" ) ) ; } } } return CodeBlocks . join ( blocks , ", " ) ;
public class PrcMoveItemsRetrieve { /** * < 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 MoveItems process ( final Map < String , Object > pAddParam , final MoveItems pEntity , final IRequestData pRequestData ) throws Exception { } }
MoveItems entity = this . prcAccEntityRetrieve . process ( pAddParam , pEntity , pRequestData ) ; String actionAdd = pRequestData . getParameter ( "actionAdd" ) ; if ( "full" . equals ( actionAdd ) ) { pRequestData . setAttribute ( "warehouseEntries" , srvWarehouseEntry . retrieveEntriesForOwner ( pAddParam , entity . constTypeCode ( ) , entity . getItsId ( ) ) ) ; pRequestData . setAttribute ( "classWarehouseEntry" , WarehouseEntry . class ) ; } return entity ;
public class PersonDocumentRepositoryMongoImpl { /** * { @ inheritDoc } */ @ Override public Collection < PersonDocument > findByFileAndSurname ( final String filename , final String surname ) { } }
if ( filename == null || surname == null ) { return Collections . emptyList ( ) ; } final Query searchQuery = new Query ( Criteria . where ( "surname" ) . is ( surname ) . and ( "filename" ) . is ( filename ) ) ; final List < PersonDocumentMongo > personDocuments = mongoTemplate . find ( searchQuery , PersonDocumentMongo . class ) ; createGedObjects ( personDocuments ) ; return copy ( personDocuments ) ;
public class SmbPipeHandleImpl { /** * { @ inheritDoc } * @ see jcifs . SmbPipeHandle # getInput ( ) */ @ Override public SmbPipeInputStream getInput ( ) throws CIFSException { } }
if ( ! this . open ) { throw new SmbException ( "Already closed" ) ; } if ( this . input != null ) { return this . input ; } try ( SmbTreeHandleImpl th = ensureTreeConnected ( ) ) { this . input = new SmbPipeInputStream ( this , th ) ; } return this . input ;
public class AnchorCell { /** * Render the contents of the HTML anchor . This method calls to an * { @ link org . apache . beehive . netui . databinding . datagrid . api . rendering . CellDecorator } associated with this tag . * The result of renderingi is appended to the < code > appender < / code > * @ param appender the { @ link AbstractRenderAppender } to which output should be rendered * @ param jspFragmentOutput the result of having evaluated this tag ' s { @ link javax . servlet . jsp . tagext . JspFragment } */ protected void renderDataCellContents ( AbstractRenderAppender appender , String jspFragmentOutput ) { } }
/* render any JavaScript needed to support framework features */ if ( _anchorState . id != null ) { HttpServletRequest request = JspUtil . getRequest ( getJspContext ( ) ) ; String script = renderNameAndId ( request , _anchorState , null ) ; _anchorCellModel . setJavascript ( script ) ; } DECORATOR . decorate ( getJspContext ( ) , appender , _anchorCellModel ) ;
public class GreedyTreeTraversal { /** * always visit the branch / node with smaller cost */ static List < Fragment > greedyTraversal ( Arborescence < Node > arborescence , Map < NodeId , Node > nodes , Map < Node , Map < Node , Fragment > > edgeFragmentChildToParent ) { } }
List < Fragment > plan = new LinkedList < > ( ) ; Map < Node , Set < Node > > edgesParentToChild = new HashMap < > ( ) ; arborescence . getParents ( ) . forEach ( ( child , parent ) -> { if ( ! edgesParentToChild . containsKey ( parent ) ) { edgesParentToChild . put ( parent , new HashSet < > ( ) ) ; } edgesParentToChild . get ( parent ) . add ( child ) ; } ) ; Node root = arborescence . getRoot ( ) ; Set < Node > reachableNodes = Sets . newHashSet ( root ) ; // expanding from the root until all nodes have been visited while ( ! reachableNodes . isEmpty ( ) ) { Node nodeWithMinCost = reachableNodes . stream ( ) . min ( Comparator . comparingDouble ( node -> branchWeight ( node , arborescence , edgesParentToChild , edgeFragmentChildToParent ) ) ) . orElse ( null ) ; assert nodeWithMinCost != null : "reachableNodes is never empty, so there is always a minimum" ; // add edge fragment first , then node fragment Fragment fragment = getEdgeFragment ( nodeWithMinCost , arborescence , edgeFragmentChildToParent ) ; if ( fragment != null ) plan . add ( fragment ) ; plan . addAll ( nodeToPlanFragments ( nodeWithMinCost , nodes , true ) ) ; reachableNodes . remove ( nodeWithMinCost ) ; if ( edgesParentToChild . containsKey ( nodeWithMinCost ) ) { reachableNodes . addAll ( edgesParentToChild . get ( nodeWithMinCost ) ) ; } } return plan ;
public class NioGroovyMethods { /** * Processes each descendant file in this directory and any sub - directories . * Convenience method for { @ link # traverse ( Path , java . util . Map , groovy . lang . Closure ) } when * no options to alter the traversal behavior are required . * @ param self a Path ( that happens to be a folder / directory ) * @ param closure the Closure to invoke on each file / directory and optionally returning a { @ link groovy . io . FileVisitResult } value * which can be used to control subsequent processing * @ throws java . io . FileNotFoundException if the given directory does not exist * @ throws IllegalArgumentException if the provided Path object does not represent a directory * @ see # traverse ( Path , java . util . Map , groovy . lang . Closure ) * @ since 2.3.0 */ public static void traverse ( final Path self , @ ClosureParams ( value = SimpleType . class , options = "java.nio.file.Path" ) final Closure closure ) throws IOException { } }
traverse ( self , new HashMap < String , Object > ( ) , closure ) ;
public class SerializationConfigurationBuilder { /** * Helper method that allows for quick registration of { @ link AdvancedExternalizer } * implementations . * @ param advancedExternalizers */ public < T > SerializationConfigurationBuilder addAdvancedExternalizer ( AdvancedExternalizer < T > ... advancedExternalizers ) { } }
for ( AdvancedExternalizer < T > advancedExternalizer : advancedExternalizers ) { this . addAdvancedExternalizer ( advancedExternalizer ) ; } return this ;
public class DefaultMonetaryAmountFormat { /** * Fully parses the text into an instance of { @ code MonetaryAmount } . * The parse must complete normally and parse the entire text . If the parse * completes without reading the entire length of the text , an exception is * thrown . If any other problem occurs during parsing , an exception is * thrown . * @ param text the text to parse , not null * @ return the parsed value , never { @ code null } * @ throws UnsupportedOperationException if the formatter is unable to parse * @ throws javax . money . format . MonetaryParseException if there is a problem while parsing */ public MonetaryAmount parse ( CharSequence text ) throws MonetaryParseException { } }
ParseContext ctx = new ParseContext ( text ) ; try { for ( FormatToken token : this . positiveTokens ) { token . parse ( ctx ) ; } } catch ( Exception e ) { // try parsing negative . . . Logger log = Logger . getLogger ( getClass ( ) . getName ( ) ) ; if ( log . isLoggable ( Level . FINEST ) ) { log . log ( Level . FINEST , "Failed to parse positive pattern, trying negative for: " + text , e ) ; } for ( FormatToken token : this . negativeTokens ) { token . parse ( ctx ) ; } } CurrencyUnit unit = ctx . getParsedCurrency ( ) ; Number num = ctx . getParsedNumber ( ) ; if ( unit == null ) { unit = this . amountFormatContext . get ( CurrencyUnit . class ) ; } if ( num == null ) { throw new MonetaryParseException ( text . toString ( ) , - 1 ) ; } MonetaryAmountFactory < ? > factory = this . amountFormatContext . getParseFactory ( ) ; if ( factory == null ) { factory = Monetary . getDefaultAmountFactory ( ) ; } return factory . setCurrency ( unit ) . setNumber ( num ) . create ( ) ;
public class CmsNewResourceTypeDialog { /** * Adds the given messages to the vfs message bundle . < p > * @ param messages the messages * @ param vfsBundleFile the bundle file * @ throws CmsException if something goes wrong writing the file */ private void addMessagesToVfsBundle ( Map < String , String > messages , CmsFile vfsBundleFile ) throws CmsException { } }
lockTemporary ( vfsBundleFile ) ; CmsObject cms = m_cms ; CmsXmlContent content = CmsXmlContentFactory . unmarshal ( cms , vfsBundleFile ) ; Locale locale = CmsLocaleManager . getDefaultLocale ( ) ; if ( ! content . hasLocale ( locale ) ) { content . addLocale ( cms , locale ) ; } Element root = content . getLocaleNode ( locale ) ; for ( Entry < String , String > entry : messages . entrySet ( ) ) { Element message = root . addElement ( CmsVfsBundleLoaderXml . N_MESSAGE ) ; Element key = message . addElement ( CmsVfsBundleLoaderXml . N_KEY ) ; key . setText ( entry . getKey ( ) ) ; Element value = message . addElement ( CmsVfsBundleLoaderXml . N_VALUE ) ; value . setText ( entry . getValue ( ) ) ; } content . initDocument ( ) ; vfsBundleFile . setContents ( content . marshal ( ) ) ; cms . writeFile ( vfsBundleFile ) ;
public class EthereumUtil { /** * Detects the object type of an RLP encoded object . Note that it does not modify the read position in the ByteBuffer . * @ param bb ByteBuffer that contains RLP encoded object * @ return object type : EthereumUtil . RLP _ OBJECTTYPE _ ELEMENT or EthereumUtil . RLP _ OBJECTTYPE _ LIST or EthereumUtil . RLP _ OBJECTTYPE _ INVALID */ public static int detectRLPObjectType ( ByteBuffer bb ) { } }
bb . mark ( ) ; byte detector = bb . get ( ) ; int unsignedDetector = detector & 0xFF ; int result = EthereumUtil . RLP_OBJECTTYPE_INVALID ; if ( unsignedDetector <= 0x7f ) { result = EthereumUtil . RLP_OBJECTTYPE_ELEMENT ; } else if ( ( unsignedDetector >= 0x80 ) && ( unsignedDetector <= 0xb7 ) ) { result = EthereumUtil . RLP_OBJECTTYPE_ELEMENT ; } else if ( ( unsignedDetector >= 0xb8 ) && ( unsignedDetector <= 0xbf ) ) { result = EthereumUtil . RLP_OBJECTTYPE_ELEMENT ; } else if ( ( unsignedDetector >= 0xc0 ) && ( unsignedDetector <= 0xf7 ) ) { result = EthereumUtil . RLP_OBJECTTYPE_LIST ; } else if ( ( unsignedDetector >= 0xf8 ) && ( unsignedDetector <= 0xff ) ) { result = EthereumUtil . RLP_OBJECTTYPE_LIST ; } else { result = EthereumUtil . RLP_OBJECTTYPE_INVALID ; LOG . error ( "Invalid RLP object type. Internal error or not RLP Data" ) ; } bb . reset ( ) ; return result ;
public class AjaxRadioPanel { /** * Factory method for create the new { @ link ListView } for the { @ link AjaxRadio } objects . This * method is invoked in the constructor from the derived classes and can be overridden so users * can provide their own version of a new { @ link ListView } for the { @ link AjaxRadio } objects . * @ param group * the group * @ param model * the model * @ return the new { @ link ListView } for the { @ link AjaxRadio } objects . */ protected Component newRadios ( final RadioGroup < T > group , final IModel < RadioGroupModelBean < T > > model ) { } }
return new ListView < T > ( "radioButtons" , model . getObject ( ) . getRadios ( ) ) { private static final long serialVersionUID = 1L ; @ Override protected void populateItem ( final ListItem < T > item ) { final AjaxRadio < T > radio = newAjaxRadio ( "radio" , group , item ) ; final Label label = ComponentFactory . newLabel ( "label" , radio . getMarkupId ( ) , new PropertyModel < String > ( item . getModel ( ) , model . getObject ( ) . getLabelPropertyExpression ( ) ) ) ; item . add ( radio ) ; item . add ( label ) ; } } ;
public class AbstractMultiInstanceLoopCharacteristicsBuilder { /** * Sets the cardinality expression . * @ param expression the cardinality expression * @ return the builder object */ public B cardinality ( String expression ) { } }
LoopCardinality cardinality = getCreateSingleChild ( LoopCardinality . class ) ; cardinality . setTextContent ( expression ) ; return myself ;
public class SubscriptionManager { /** * Removes all the listeners for a < b > single < / b > event generator * @ param source the event publisher */ public void unsubscribeAll ( EventPublisher source ) { } }
log . debug ( "[unsubscribeAll] Cleaning all listeners for {}" , source . getClass ( ) . getName ( ) ) ; GenericEventDispatcher < ? > dispatcher = dispatchers . get ( source ) ; if ( dispatcher != null ) { dispatcher . removeListeners ( ) ; }
public class Builder { /** * Dump out abstract syntax tree for a given expression * @ param args array with one element , containing the expression string */ public static void main ( String [ ] args ) { } }
if ( args . length != 1 ) { System . err . println ( "usage: java " + Builder . class . getName ( ) + " <expression string>" ) ; System . exit ( 1 ) ; } PrintWriter out = new PrintWriter ( System . out ) ; Tree tree = null ; try { tree = new Builder ( Feature . METHOD_INVOCATIONS ) . build ( args [ 0 ] ) ; } catch ( TreeBuilderException e ) { System . out . println ( e . getMessage ( ) ) ; System . exit ( 0 ) ; } NodePrinter . dump ( out , tree . getRoot ( ) ) ; if ( ! tree . getFunctionNodes ( ) . iterator ( ) . hasNext ( ) && ! tree . getIdentifierNodes ( ) . iterator ( ) . hasNext ( ) ) { ELContext context = new ELContext ( ) { @ Override public VariableMapper getVariableMapper ( ) { return null ; } @ Override public FunctionMapper getFunctionMapper ( ) { return null ; } @ Override public ELResolver getELResolver ( ) { return null ; } } ; out . print ( ">> " ) ; try { out . println ( tree . getRoot ( ) . getValue ( new Bindings ( null , null ) , context , null ) ) ; } catch ( ELException e ) { out . println ( e . getMessage ( ) ) ; } } out . flush ( ) ;
public class CommerceNotificationTemplateUserSegmentRelPersistenceImpl { /** * Returns the last commerce notification template user segment rel in the ordered set where commerceNotificationTemplateId = & # 63 ; . * @ param commerceNotificationTemplateId the commerce notification template ID * @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > ) * @ return the last matching commerce notification template user segment rel * @ throws NoSuchNotificationTemplateUserSegmentRelException if a matching commerce notification template user segment rel could not be found */ @ Override public CommerceNotificationTemplateUserSegmentRel findByCommerceNotificationTemplateId_Last ( long commerceNotificationTemplateId , OrderByComparator < CommerceNotificationTemplateUserSegmentRel > orderByComparator ) throws NoSuchNotificationTemplateUserSegmentRelException { } }
CommerceNotificationTemplateUserSegmentRel commerceNotificationTemplateUserSegmentRel = fetchByCommerceNotificationTemplateId_Last ( commerceNotificationTemplateId , orderByComparator ) ; if ( commerceNotificationTemplateUserSegmentRel != null ) { return commerceNotificationTemplateUserSegmentRel ; } StringBundler msg = new StringBundler ( 4 ) ; msg . append ( _NO_SUCH_ENTITY_WITH_KEY ) ; msg . append ( "commerceNotificationTemplateId=" ) ; msg . append ( commerceNotificationTemplateId ) ; msg . append ( "}" ) ; throw new NoSuchNotificationTemplateUserSegmentRelException ( msg . toString ( ) ) ;
public class NonNsStreamWriter { /** * Method called to close an open start element , when another * main - level element ( not namespace declaration or * attribute ) is being output ; except for end element which is * handled differently . */ @ Override protected void closeStartElement ( boolean emptyElem ) throws XMLStreamException { } }
mStartElementOpen = false ; if ( mAttrNames != null ) { mAttrNames . clear ( ) ; } try { if ( emptyElem ) { mWriter . writeStartTagEmptyEnd ( ) ; } else { mWriter . writeStartTagEnd ( ) ; } } catch ( IOException ioe ) { throwFromIOE ( ioe ) ; } if ( mValidator != null ) { mVldContent = mValidator . validateElementAndAttributes ( ) ; } // Need bit more special handling for empty elements . . . if ( emptyElem ) { String localName = mElements . removeLast ( ) ; if ( mElements . isEmpty ( ) ) { mState = STATE_EPILOG ; } if ( mValidator != null ) { mVldContent = mValidator . validateElementEnd ( localName , XmlConsts . ELEM_NO_NS_URI , XmlConsts . ELEM_NO_PREFIX ) ; } }
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public EClass getIfcDistributionFlowElement ( ) { } }
if ( ifcDistributionFlowElementEClass == null ) { ifcDistributionFlowElementEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 185 ) ; } return ifcDistributionFlowElementEClass ;
public class DateIntervalInfo { /** * Clone an unfrozen DateIntervalInfo object . * @ return a copy of the object */ private Object cloneUnfrozenDII ( ) // throws IllegalStateException { } }
try { DateIntervalInfo other = ( DateIntervalInfo ) super . clone ( ) ; other . fFallbackIntervalPattern = fFallbackIntervalPattern ; other . fFirstDateInPtnIsLaterDate = fFirstDateInPtnIsLaterDate ; if ( fIntervalPatternsReadOnly ) { other . fIntervalPatterns = fIntervalPatterns ; other . fIntervalPatternsReadOnly = true ; } else { other . fIntervalPatterns = cloneIntervalPatterns ( fIntervalPatterns ) ; other . fIntervalPatternsReadOnly = false ; } other . frozen = false ; return other ; } catch ( CloneNotSupportedException e ) { // / CLOVER : OFF throw new ICUCloneNotSupportedException ( "clone is not supported" , e ) ; // / CLOVER : ON }
public class CmsFlexCache { /** * Adds a key with a new , empty variation map to the cache . < p > * @ param key the key to add to the cache . */ void putKey ( CmsFlexCacheKey key ) { } }
if ( ! isEnabled ( ) ) { return ; } Object o = m_keyCache . get ( key . getResource ( ) ) ; if ( o == null ) { // No variation map for this resource yet , so create one CmsFlexCacheVariation variationMap = new CmsFlexCacheVariation ( key ) ; m_keyCache . put ( key . getResource ( ) , variationMap ) ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_FLEXCACHE_ADD_KEY_1 , key . getResource ( ) ) ) ; } } // If ! = null the key is already in the cache , so we just do nothing
public class SaltScanner { /** * Called once all of the scanners have reported back in to record our * latency and merge the results into the spans map . If there was an exception * stored then we ' ll return that instead . */ private void mergeDataPoints ( ) { } }
// Merge sorted spans together final long merge_start = DateTime . nanoTime ( ) ; for ( final List < KeyValue > kvs : kv_map . values ( ) ) { if ( kvs == null || kvs . isEmpty ( ) ) { LOG . warn ( "Found a key value list that was null or empty" ) ; continue ; } for ( final KeyValue kv : kvs ) { if ( kv == null ) { LOG . warn ( "Found a key value item that was null" ) ; continue ; } if ( kv . key ( ) == null ) { LOG . warn ( "A key for a kv was null" ) ; continue ; } Span datapoints = spans . get ( kv . key ( ) ) ; if ( datapoints == null ) { datapoints = RollupQuery . isValidQuery ( rollup_query ) ? new RollupSpan ( tsdb , this . rollup_query ) : new Span ( tsdb ) ; spans . put ( kv . key ( ) , datapoints ) ; } if ( annotation_map . containsKey ( kv . key ( ) ) ) { for ( final Annotation note : annotation_map . get ( kv . key ( ) ) ) { datapoints . getAnnotations ( ) . add ( note ) ; } annotation_map . remove ( kv . key ( ) ) ; } try { datapoints . addRow ( kv ) ; } catch ( RuntimeException e ) { LOG . error ( "Exception adding row to span" , e ) ; throw e ; } } } kv_map . clear ( ) ; for ( final byte [ ] key : annotation_map . keySet ( ) ) { Span datapoints = spans . get ( key ) ; if ( datapoints == null ) { datapoints = new Span ( tsdb ) ; spans . put ( key , datapoints ) ; } for ( final Annotation note : annotation_map . get ( key ) ) { datapoints . getAnnotations ( ) . add ( note ) ; } } annotation_map . clear ( ) ;
public class PolynomialFit { /** * Removes the observation that fits the model the worst and recomputes the coefficients . * This is done efficiently by using an adjustable solver . Often times the elements with * the largest errors are outliers and not part of the system being modeled . By removing them * a more accurate set of coefficients can be computed . */ public void removeWorstFit ( ) { } }
// find the observation with the most error int worstIndex = - 1 ; double worstError = - 1 ; for ( int i = 0 ; i < y . numRows ; i ++ ) { double predictedObs = 0 ; for ( int j = 0 ; j < coef . numRows ; j ++ ) { predictedObs += A . get ( i , j ) * coef . get ( j , 0 ) ; } double error = Math . abs ( predictedObs - y . get ( i , 0 ) ) ; if ( error > worstError ) { worstError = error ; worstIndex = i ; } } // nothing left to remove , so just return if ( worstIndex == - 1 ) return ; // remove that observation removeObservation ( worstIndex ) ; // update A solver . removeRowFromA ( worstIndex ) ; // solve for the parameters again solver . solve ( y , coef ) ;
public class CheckpointStatsHistory { /** * Creates a snapshot of the current state . * @ return Snapshot of the current state . */ CheckpointStatsHistory createSnapshot ( ) { } }
if ( readOnly ) { throw new UnsupportedOperationException ( "Can't create a snapshot of a read-only history." ) ; } List < AbstractCheckpointStats > checkpointsHistory ; Map < Long , AbstractCheckpointStats > checkpointsById ; checkpointsById = new HashMap < > ( checkpointsArray . length ) ; if ( maxSize == 0 ) { checkpointsHistory = Collections . emptyList ( ) ; } else { AbstractCheckpointStats [ ] newCheckpointsArray = new AbstractCheckpointStats [ checkpointsArray . length ] ; System . arraycopy ( checkpointsArray , nextPos , newCheckpointsArray , 0 , checkpointsArray . length - nextPos ) ; System . arraycopy ( checkpointsArray , 0 , newCheckpointsArray , checkpointsArray . length - nextPos , nextPos ) ; checkpointsHistory = Arrays . asList ( newCheckpointsArray ) ; // reverse the order such that we start with the youngest checkpoint Collections . reverse ( checkpointsHistory ) ; for ( AbstractCheckpointStats checkpoint : checkpointsHistory ) { checkpointsById . put ( checkpoint . getCheckpointId ( ) , checkpoint ) ; } } if ( latestCompletedCheckpoint != null ) { checkpointsById . put ( latestCompletedCheckpoint . getCheckpointId ( ) , latestCompletedCheckpoint ) ; } if ( latestFailedCheckpoint != null ) { checkpointsById . put ( latestFailedCheckpoint . getCheckpointId ( ) , latestFailedCheckpoint ) ; } if ( latestSavepoint != null ) { checkpointsById . put ( latestSavepoint . getCheckpointId ( ) , latestSavepoint ) ; } return new CheckpointStatsHistory ( true , maxSize , null , checkpointsHistory , checkpointsById , latestCompletedCheckpoint , latestFailedCheckpoint , latestSavepoint ) ;
public class CodeBuilder { /** * flow control instructions */ private void branch ( int stackAdjust , Location location , byte opcode ) { } }
if ( ! ( location instanceof InstructionList . LabelInstruction ) ) { throw new IllegalArgumentException ( "Branch location is not a label instruction" ) ; } mInstructions . new BranchInstruction ( stackAdjust , opcode , ( InstructionList . LabelInstruction ) location ) ;
public class ReflectionUtil { /** * Replies the top - most type which is common to both given types . * @ param type1 first type . * @ param type2 second type . * @ return the top - most type which is common to both given types . * @ since 6.0 */ public static Class < ? > getCommonType ( Class < ? > type1 , Class < ? > type2 ) { } }
if ( type1 == null ) { return type2 ; } if ( type2 == null ) { return type1 ; } Class < ? > top = type1 ; while ( ! top . isAssignableFrom ( type2 ) ) { top = top . getSuperclass ( ) ; assert top != null ; } return top ;
public class FileSystemArtifactStore { /** * { @ inheritDoc } */ public Set < String > getGroupIds ( String parentGroupId ) { } }
Entry parentEntry = StringUtils . isEmpty ( parentGroupId ) ? backing . getRoot ( ) : backing . get ( parentGroupId . replace ( '.' , '/' ) ) ; if ( ! ( parentEntry instanceof DirectoryEntry ) ) { return Collections . emptySet ( ) ; } DirectoryEntry parentDir = ( DirectoryEntry ) parentEntry ; Entry [ ] entries = backing . listEntries ( parentDir ) ; Set < String > result = new HashSet < String > ( ) ; for ( int i = 0 ; i < entries . length ; i ++ ) { if ( entries [ i ] instanceof DirectoryEntry ) { result . add ( entries [ i ] . getName ( ) ) ; } } return result ;
public class TaskLauncherManager { /** * 启动 TaskLauncher * @ param millis 触发事件的毫秒数 * @ return { @ link TaskLauncher } */ protected TaskLauncher spawnLauncher ( long millis ) { } }
final TaskLauncher launcher = new TaskLauncher ( this . scheduler , millis ) ; synchronized ( this . launchers ) { this . launchers . add ( launcher ) ; } // 子线程是否为deamon线程取决于父线程 , 因此此处无需显示调用 // launcher . setDaemon ( this . scheduler . daemon ) ; // launcher . start ( ) ; this . scheduler . threadExecutor . execute ( launcher ) ; return launcher ;
public class HectorObjectMapper { /** * Create Set of HColumns for the given Object . The Object must be annotated * with { @ link Column } on the desired fields . * @ param obj * @ return */ private Collection < HColumn < String , byte [ ] > > createColumnSet ( Object obj ) { } }
Map < String , HColumn < String , byte [ ] > > map = createColumnMap ( obj ) ; if ( null != map ) { return map . values ( ) ; } else { return null ; }
public class GitCredentialsProviderFactory { /** * Search for a credential provider that will handle the specified URI . If not found , * and the username or passphrase has text , then create a default using the provided * username and password or passphrase . Otherwise null . * @ param uri the URI of the repository ( cannot be null ) * @ param username the username provided for the repository ( may be null ) * @ param password the password provided for the repository ( may be null ) * @ param passphrase the passphrase to unlock the ssh private key ( may be null ) * @ return the first matched credentials provider or the default or null . * @ deprecated in favour of * { @ link # createFor ( String , String , String , String , boolean ) } */ @ Deprecated public CredentialsProvider createFor ( String uri , String username , String password , String passphrase ) { } }
return createFor ( uri , username , password , passphrase , false ) ;
public class KiteConnect { /** * Retrieves historical data for an instrument . * @ param from " yyyy - mm - dd " for fetching candles between days and " yyyy - mm - dd hh : mm : ss " for fetching candles between timestamps . * @ param to " yyyy - mm - dd " for fetching candles between days and " yyyy - mm - dd hh : mm : ss " for fetching candles between timestamps . * @ param continuous set to true for fetching continuous data of expired instruments . * @ param interval can be minute , day , 3minute , 5minute , 10minute , 15minute , 30minute , 60minute . * @ param token is instruments token . * @ return HistoricalData object which contains list of historical data termed as dataArrayList . * @ throws KiteException is thrown for all Kite trade related errors . * @ throws IOException is thrown when there is connection related error . */ public HistoricalData getHistoricalData ( Date from , Date to , String token , String interval , boolean continuous ) throws KiteException , IOException , JSONException { } }
SimpleDateFormat format = new SimpleDateFormat ( "yyyy-MM-dd HH:mm:ss" ) ; Map < String , Object > params = new HashMap < > ( ) ; params . put ( "from" , format . format ( from ) ) ; params . put ( "to" , format . format ( to ) ) ; params . put ( "continuous" , continuous ? 1 : 0 ) ; String url = routes . get ( "market.historical" ) . replace ( ":instrument_token" , token ) . replace ( ":interval" , interval ) ; HistoricalData historicalData = new HistoricalData ( ) ; historicalData . parseResponse ( new KiteRequestHandler ( proxy ) . getRequest ( url , params , apiKey , accessToken ) ) ; return historicalData ;
public class BaseElement { /** * Intended to be called by extending classes { @ link # isEmpty ( ) } implementations , returns < code > true < / code > if all * content in this superclass instance is empty per the semantics of { @ link # isEmpty ( ) } . */ protected boolean isBaseEmpty ( ) { } }
if ( myUndeclaredExtensions != null ) { for ( ExtensionDt next : myUndeclaredExtensions ) { if ( next == null ) { continue ; } if ( ! next . isEmpty ( ) ) { return false ; } } } if ( myUndeclaredModifierExtensions != null ) { for ( ExtensionDt next : myUndeclaredModifierExtensions ) { if ( next == null ) { continue ; } if ( ! next . isEmpty ( ) ) { return false ; } } } return true ;
public class NfsFileInputStream { /** * ( non - Javadoc ) * @ see java . io . InputStream # read ( byte [ ] , int , int ) */ public int read ( byte [ ] b , int off , int len ) throws IOException { } }
checkForClosed ( ) ; if ( b == null ) { throw new NullPointerException ( ) ; } else if ( ( off < 0 ) || ( len < 0 ) || ( ( off + len ) > b . length ) ) { throw new IndexOutOfBoundsException ( ) ; } else if ( len == 0 ) { return 0 ; } loadBytesAsNeeded ( ) ; int bytesImmediatelyAvailable = bytesLeftInBuffer ( ) ; if ( len <= bytesImmediatelyAvailable ) { System . arraycopy ( _bytes , _currentBufferPosition , b , off , len ) ; _currentBufferPosition += len ; return len ; } int bytesRead = EOF ; if ( bytesImmediatelyAvailable > 0 ) { bytesRead = read ( b , off , bytesImmediatelyAvailable ) ; if ( bytesRead != EOF ) { int furtherBytesRead = read ( b , off + bytesRead , len - bytesRead ) ; if ( furtherBytesRead != EOF ) { bytesRead += furtherBytesRead ; } } } return bytesRead ;
public class Dim { /** * Returns the value of a property on the given script object . */ public Object getObjectProperty ( Object object , Object id ) { } }
DimIProxy action = new DimIProxy ( this , IPROXY_OBJECT_PROPERTY ) ; action . object = object ; action . id = id ; action . withContext ( ) ; return action . objectResult ;
public class BrokerHelper { /** * Returns an object array for { @ link java . util . Collection } , array or * { @ link org . apache . ojb . broker . ManageableCollection } instances . * @ param collectionOrArray a none < em > null < / em > object of type { @ link java . util . Collection } , * Array or { @ link org . apache . ojb . broker . ManageableCollection } . * @ return Object array able to handle given collection or array object */ public static Object [ ] getCollectionArray ( Object collectionOrArray ) { } }
Object [ ] result ; if ( collectionOrArray instanceof Collection ) { result = ( ( Collection ) collectionOrArray ) . toArray ( ) ; } else if ( collectionOrArray instanceof ManageableCollection ) { Collection newCol = new ArrayList ( ) ; CollectionUtils . addAll ( newCol , ( ( ManageableCollection ) collectionOrArray ) . ojbIterator ( ) ) ; result = newCol . toArray ( ) ; } else if ( collectionOrArray . getClass ( ) . isArray ( ) ) { result = ( Object [ ] ) collectionOrArray ; } else { throw new OJBRuntimeException ( "Given object collection of type '" + ( collectionOrArray != null ? collectionOrArray . getClass ( ) . toString ( ) : "null" ) + "' can not be managed by OJB. Use Array, Collection or ManageableCollection instead!" ) ; } return result ;
public class Grego { /** * Return the day of week on the 1970 - epoch day * @ param day the 1970 - epoch day ( integral value ) * @ return the day of week */ public static int dayOfWeek ( long day ) { } }
long [ ] remainder = new long [ 1 ] ; floorDivide ( day + Calendar . THURSDAY , 7 , remainder ) ; int dayOfWeek = ( int ) remainder [ 0 ] ; dayOfWeek = ( dayOfWeek == 0 ) ? 7 : dayOfWeek ; return dayOfWeek ;
public class ActionContext { /** * Get request parameter as a String . * @ param name Parameter name * @ param defaultValue Parameter default value ( can be null ) * @ return Parameter value */ public String getParameterAsString ( String name , String defaultValue ) { } }
return defaultValue ( blankToNull ( getParameter ( name ) ) , defaultValue ) ;
public class TransactionalSharedLuceneLock { /** * Starts a new transaction . Used to batch changes in LuceneDirectory : * a transaction is created at lock acquire , and closed on release . * It ' s also committed and started again at each IndexWriter . commit ( ) ; * @ throws IOException wraps Infinispan exceptions to adapt to Lucene ' s API */ private void startTransaction ( ) throws IOException { } }
try { tm . begin ( ) ; } catch ( Exception e ) { log . unableToStartTransaction ( e ) ; throw new IOException ( "SharedLuceneLock could not start a transaction after having acquired the lock" , e ) ; } if ( trace ) { log . tracef ( "Batch transaction started for index: %s" , indexName ) ; }
public class ListUtil { /** * finds a value inside a list , do not ignore case * @ param list list to search * @ param value value to find * @ param delimiter delimiter of the list * @ return position in list ( 0 - n ) or - 1 */ public static int listFindNoCase ( String list , String value , String delimiter ) { } }
return listFindNoCase ( list , value , delimiter , true ) ;
public class FSDirectory { /** * Updates the in memory inode for the file with the new information and * returns a reference to the INodeFile . This method in most cases would * return a { @ link INodeFileUnderConstruction } , the only case where it should * return a { @ link INodeFile } would be when it tries to update an already * closed file . * @ return reference to the { @ link INodeFile } * @ throws IOException */ protected INodeFile updateINodefile ( long inodeId , String path , PermissionStatus permissions , Block [ ] blocks , short replication , long mtime , long atime , long blockSize , String clientName , String clientMachine ) throws IOException { } }
writeLock ( ) ; try { INode node = getINode ( path ) ; if ( ! exists ( node ) ) { return this . unprotectedAddFile ( inodeId , path , permissions , replication , mtime , atime , blockSize , clientName , clientMachine ) ; } if ( node . isDirectory ( ) ) { throw new IOException ( path + " is a directory" ) ; } INodeFile file = ( INodeFile ) node ; BlockInfo [ ] oldblocks = file . getBlocks ( ) ; if ( oldblocks == null ) { throw new IOException ( "blocks for file are null : " + path ) ; } // Update the inode with new information . BlockInfo [ ] blockInfo = new BlockInfo [ blocks . length ] ; for ( int i = 0 ; i < blocks . length ; i ++ ) { // Need to use update inode here , because when we add a block to the // NameNode , it is persisted to the edit log with size 0 , now when we // persist another block to the edit log then the previous block // length has been calculated already and we write the new block // length to the edit log . But during ingest , the old block length of // 0 has already been stored and it is reused in BlocksMap # addINode ( ) // instead of overwriting the new value . BlockInfo oldblock = ( i < oldblocks . length ) ? oldblocks [ i ] : null ; blockInfo [ i ] = getFSNamesystem ( ) . blocksMap . updateINode ( oldblock , blocks [ i ] , file , file . getReplication ( ) , false ) ; } int remaining = oldblocks . length - blocks . length ; if ( remaining > 0 ) { if ( remaining > 1 ) throw new IOException ( "Edit log indicates more than one block was" + " abandoned" ) ; // The last block is no longer part of the file , mostly was abandoned . getFSNamesystem ( ) . blocksMap . removeBlock ( oldblocks [ oldblocks . length - 1 ] ) ; } file . updateFile ( permissions , blockInfo , replication , mtime , atime , blockSize ) ; return file ; } finally { writeUnlock ( ) ; }
public class Card { /** * Checks whether or not the { @ link # expYear } field is valid . * @ return { @ code true } if valid , { @ code false } otherwise . */ boolean validateExpYear ( @ NonNull Calendar now ) { } }
return expYear != null && ! ModelUtils . hasYearPassed ( expYear , now ) ;