signature
stringlengths 43
39.1k
| implementation
stringlengths 0
450k
|
---|---|
public class ChineseCalendar { /** * / * [ deutsch ]
* < p > Erzeugt ein neues chinesisches Kalenderdatum am traditionellen Neujahrstag . < / p >
* @ param gregorianYear gregorian calendar year
* @ return new instance of { @ code ChineseCalendar }
* @ throws IllegalArgumentException in case of any inconsistencies */
public static ChineseCalendar ofNewYear ( int gregorianYear ) { } } | return ChineseCalendar . of ( EastAsianYear . forGregorian ( gregorianYear ) , EastAsianMonth . valueOf ( 1 ) , 1 ) ; |
public class ModifyReplicationInstanceRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ModifyReplicationInstanceRequest modifyReplicationInstanceRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( modifyReplicationInstanceRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( modifyReplicationInstanceRequest . getReplicationInstanceArn ( ) , REPLICATIONINSTANCEARN_BINDING ) ; protocolMarshaller . marshall ( modifyReplicationInstanceRequest . getAllocatedStorage ( ) , ALLOCATEDSTORAGE_BINDING ) ; protocolMarshaller . marshall ( modifyReplicationInstanceRequest . getApplyImmediately ( ) , APPLYIMMEDIATELY_BINDING ) ; protocolMarshaller . marshall ( modifyReplicationInstanceRequest . getReplicationInstanceClass ( ) , REPLICATIONINSTANCECLASS_BINDING ) ; protocolMarshaller . marshall ( modifyReplicationInstanceRequest . getVpcSecurityGroupIds ( ) , VPCSECURITYGROUPIDS_BINDING ) ; protocolMarshaller . marshall ( modifyReplicationInstanceRequest . getPreferredMaintenanceWindow ( ) , PREFERREDMAINTENANCEWINDOW_BINDING ) ; protocolMarshaller . marshall ( modifyReplicationInstanceRequest . getMultiAZ ( ) , MULTIAZ_BINDING ) ; protocolMarshaller . marshall ( modifyReplicationInstanceRequest . getEngineVersion ( ) , ENGINEVERSION_BINDING ) ; protocolMarshaller . marshall ( modifyReplicationInstanceRequest . getAllowMajorVersionUpgrade ( ) , ALLOWMAJORVERSIONUPGRADE_BINDING ) ; protocolMarshaller . marshall ( modifyReplicationInstanceRequest . getAutoMinorVersionUpgrade ( ) , AUTOMINORVERSIONUPGRADE_BINDING ) ; protocolMarshaller . marshall ( modifyReplicationInstanceRequest . getReplicationInstanceIdentifier ( ) , REPLICATIONINSTANCEIDENTIFIER_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class TypeConversionUtil { /** * Convert an array of primitives or Objects like double [ ] [ ] or Double [ ] into the requested type . 2D array will be
* converted to a 1D array
* @ param < T >
* @ param type
* the componant type
* @ param val
* @ return
* @ throws DevFailed */
public static < T > Object castToArray ( final Class < T > type , final Object val ) throws DevFailed { } } | Object result = null ; final Object array1D = val ; if ( val == null || type . isAssignableFrom ( val . getClass ( ) ) ) { result = val ; } else { LOGGER . debug ( "converting {} to {}" , val . getClass ( ) . getCanonicalName ( ) , type . getCanonicalName ( ) ) ; final Class < ? > typeConv = Array . newInstance ( type , 0 ) . getClass ( ) ; final Transmorph transmorph = new Transmorph ( creatConv ( ) ) ; try { result = transmorph . convert ( array1D , typeConv ) ; } catch ( final ConverterException e ) { LOGGER . error ( "convertion error" , e ) ; throw DevFailedUtils . newDevFailed ( e ) ; } } return result ; |
public class RedmineJSONParser { /** * Fetches an optional date from an object .
* @ param obj
* object to get a field from .
* @ param field
* field to get a value from .
* @ throws RedmineFormatException
* if value is not valid */
private static Date getShortDateOrNull ( JSONObject obj , String field ) throws JSONException { } } | final String dateStr = JsonInput . getStringOrNull ( obj , field ) ; if ( dateStr == null ) { return null ; } final SimpleDateFormat dateFormat ; if ( dateStr . length ( ) >= 5 && dateStr . charAt ( 4 ) == '/' ) dateFormat = RedmineDateUtils . SHORT_DATE_FORMAT . get ( ) ; else dateFormat = RedmineDateUtils . SHORT_DATE_FORMAT_V2 . get ( ) ; try { return dateFormat . parse ( dateStr ) ; } catch ( ParseException e ) { throw new JSONException ( "Bad date " + dateStr ) ; } |
public class KnowledgeRuntimeManagerFactory { /** * Creates a new KnowledgeRuntimeManager .
* @ param type the KnowledgeRuntimeManagerType
* @ return the new KnowledgeRuntimeManager */
public KnowledgeRuntimeManager newRuntimeManager ( KnowledgeRuntimeManagerType type ) { } } | RuntimeManager runtimeManager ; final String identifier = _identifierRoot + IDENTIFIER_COUNT . incrementAndGet ( ) ; final ClassLoader origTCCL = Classes . setTCCL ( _classLoader ) ; try { runtimeManager = _runtimeManagerBuilder . build ( type , identifier ) ; } finally { Classes . setTCCL ( origTCCL ) ; } return new KnowledgeRuntimeManager ( _classLoader , type , _serviceDomainName , _serviceName , runtimeManager , _persistent , _channelBuilders , _loggerBuilders ) ; |
public class MathExpressions { /** * Create a { @ code coth ( num ) } expression
* < p > Returns the hyperbolic cotangent of num . < / p >
* @ param num numeric expression
* @ return coth ( num ) */
public static < A extends Number & Comparable < ? > > NumberExpression < Double > coth ( Expression < A > num ) { } } | return Expressions . numberOperation ( Double . class , Ops . MathOps . COTH , num ) ; |
public class LinearSystem { /** * Iteratively improve the solution x to machine accuracy .
* @ param b the right - hand side column vector
* @ param x the improved solution column vector
* @ throws matrix . MatrixException if failed to converge */
private void improve ( ColumnVector b , ColumnVector x ) throws MatrixException { } } | // Find the largest x element .
double largestX = 0 ; for ( int r = 0 ; r < nRows ; ++ r ) { double absX = Math . abs ( x . values [ r ] [ 0 ] ) ; if ( largestX < absX ) largestX = absX ; } // Is x already as good as possible ?
if ( largestX == 0 ) return ; ColumnVector residuals = new ColumnVector ( nRows ) ; // Iterate to improve x .
for ( int iter = 0 ; iter < MAX_ITER ; ++ iter ) { // Compute residuals = b - Ax .
// Must use double precision !
for ( int r = 0 ; r < nRows ; ++ r ) { double dot = 0 ; double row [ ] = values [ r ] ; for ( int c = 0 ; c < nRows ; ++ c ) { double elmt = at ( r , c ) ; dot += elmt * x . at ( c ) ; // dbl . prec . *
} double value = b . at ( r ) - dot ; // dbl . prec . -
residuals . set ( r , ( double ) value ) ; } // Solve Az = residuals for z .
ColumnVector z = solve ( residuals , false ) ; // Set x = x + z .
// Find largest the largest difference .
double largestDiff = 0 ; for ( int r = 0 ; r < nRows ; ++ r ) { double oldX = x . at ( r ) ; x . set ( r , oldX + z . at ( r ) ) ; double diff = Math . abs ( x . at ( r ) - oldX ) ; if ( largestDiff < diff ) largestDiff = diff ; } // Is any further improvement possible ?
if ( largestDiff < largestX * TOLERANCE ) return ; } // Failed to converge because A is nearly singular .
throw new MatrixException ( MatrixException . NO_CONVERGENCE ) ; |
public class SpatialReferenceSystemDao { /** * { @ inheritDoc } */
@ Override public int create ( SpatialReferenceSystem srs ) throws SQLException { } } | int result = super . create ( srs ) ; updateDefinition_12_063 ( srs ) ; return result ; |
public class GeneralValidator { /** * Processes the specified rule input .
* @ param ruleInput Rule input to be validated . */
private void processRules ( RI ruleInput ) { } } | switch ( ruleToResultHandlerMapping ) { case SPLIT : processEachRuleWithEachResultHandler ( ruleInput ) ; break ; case JOIN : processAllRulesWithEachResultHandler ( ruleInput ) ; break ; default : LOGGER . error ( "Unsupported " + MappingStrategy . class . getSimpleName ( ) + ": " + ruleToResultHandlerMapping ) ; } |
public class ZookeeperNodeInfoMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ZookeeperNodeInfo zookeeperNodeInfo , ProtocolMarshaller protocolMarshaller ) { } } | if ( zookeeperNodeInfo == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( zookeeperNodeInfo . getAttachedENIId ( ) , ATTACHEDENIID_BINDING ) ; protocolMarshaller . marshall ( zookeeperNodeInfo . getClientVpcIpAddress ( ) , CLIENTVPCIPADDRESS_BINDING ) ; protocolMarshaller . marshall ( zookeeperNodeInfo . getZookeeperId ( ) , ZOOKEEPERID_BINDING ) ; protocolMarshaller . marshall ( zookeeperNodeInfo . getZookeeperVersion ( ) , ZOOKEEPERVERSION_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class BugTreeModel { /** * Recursively traverses the tree , opens all nodes matching any bug in the
* list , then creates the full paths to the bugs that are selected This
* keeps whatever bugs were selected selected when sorting DEPRECATED - - Too
* Slow , use openPreviouslySelected */
public void crawlToOpen ( TreePath path , ArrayList < BugLeafNode > bugLeafNodes , ArrayList < TreePath > treePaths ) { } } | for ( int i = 0 ; i < getChildCount ( path . getLastPathComponent ( ) ) ; i ++ ) { if ( ! isLeaf ( getChild ( path . getLastPathComponent ( ) , i ) ) ) { for ( BugLeafNode p : bugLeafNodes ) { if ( p . matches ( ( BugAspects ) getChild ( path . getLastPathComponent ( ) , i ) ) ) { tree . expandPath ( path ) ; crawlToOpen ( path . pathByAddingChild ( getChild ( path . getLastPathComponent ( ) , i ) ) , bugLeafNodes , treePaths ) ; break ; } } } else { for ( BugLeafNode b : bugLeafNodes ) { if ( getChild ( path . getLastPathComponent ( ) , i ) . equals ( b ) ) { tree . expandPath ( path ) ; treePaths . add ( path . pathByAddingChild ( getChild ( path . getLastPathComponent ( ) , i ) ) ) ; } } } } |
public class ProgressDialogFragment { /** * Creates and shows an indeterminate progress dialog . Once the progress dialog is shown , it
* will be shown for at least the minDisplayTime ( in milliseconds ) , so that the progress dialog
* does not flash in and out to quickly . */
public static ProgressDialogFragment create ( CharSequence title , CharSequence message , boolean cancelable ) { } } | ProgressDialogFragment dialogFragment = new ProgressDialogFragment ( ) ; dialogFragment . mTitle = title ; dialogFragment . mMessage = message ; dialogFragment . setCancelable ( cancelable ) ; return dialogFragment ; |
public class CmsRepositoryFilter { /** * Checks if a path is filtered out of the filter or not . < p >
* @ param path the path of a resource to check
* @ return true if the name matches one of the given filter patterns */
public boolean isFiltered ( String path ) { } } | for ( int j = 0 ; j < m_filterRules . size ( ) ; j ++ ) { Pattern pattern = m_filterRules . get ( j ) ; if ( isPartialMatch ( pattern , path ) ) { return m_type . equals ( TYPE_EXCLUDE ) ; } } return m_type . equals ( TYPE_INCLUDE ) ; |
public class RdsHttpEndpointConfigMarshaller { /** * Marshall the given parameter object . */
public void marshall ( RdsHttpEndpointConfig rdsHttpEndpointConfig , ProtocolMarshaller protocolMarshaller ) { } } | if ( rdsHttpEndpointConfig == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( rdsHttpEndpointConfig . getAwsRegion ( ) , AWSREGION_BINDING ) ; protocolMarshaller . marshall ( rdsHttpEndpointConfig . getDbClusterIdentifier ( ) , DBCLUSTERIDENTIFIER_BINDING ) ; protocolMarshaller . marshall ( rdsHttpEndpointConfig . getDatabaseName ( ) , DATABASENAME_BINDING ) ; protocolMarshaller . marshall ( rdsHttpEndpointConfig . getSchema ( ) , SCHEMA_BINDING ) ; protocolMarshaller . marshall ( rdsHttpEndpointConfig . getAwsSecretStoreArn ( ) , AWSSECRETSTOREARN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class Statement { /** * Searches for best matching method for given name and argument types . */
static Method findMethod ( Class < ? > clazz , String methodName , Object [ ] args , boolean isStatic ) throws NoSuchMethodException { } } | Class < ? > [ ] argTypes = getTypes ( args ) ; Method [ ] methods = null ; if ( classMethodsCache . containsKey ( clazz ) ) { methods = classMethodsCache . get ( clazz ) ; } else { methods = clazz . getMethods ( ) ; classMethodsCache . put ( clazz , methods ) ; } ArrayList < Method > fitMethods = new ArrayList < Method > ( ) ; for ( Method method : methods ) { if ( methodName . equals ( method . getName ( ) ) ) { if ( ! isStatic || Modifier . isStatic ( method . getModifiers ( ) ) ) { if ( match ( argTypes , method . getParameterTypes ( ) ) ) { fitMethods . add ( method ) ; } } } } int fitSize = fitMethods . size ( ) ; if ( fitSize == 0 ) { throw new NoSuchMethodException ( Messages . getString ( "beans.41" , methodName ) ) ; // $ NON - NLS - 1 $
} if ( fitSize == 1 ) { return fitMethods . get ( 0 ) ; } // find the most relevant one
MethodComparator comparator = new MethodComparator ( methodName , argTypes ) ; Method [ ] fitMethodArray = fitMethods . toArray ( new Method [ fitSize ] ) ; Method onlyMethod = fitMethodArray [ 0 ] ; Class < ? > onlyReturnType , fitReturnType ; int difference ; for ( int i = 1 ; i < fitMethodArray . length ; i ++ ) { // if 2 methods have same relevance , check their return type
if ( ( difference = comparator . compare ( onlyMethod , fitMethodArray [ i ] ) ) == 0 ) { // if 2 methods have the same signature , check their return type
onlyReturnType = onlyMethod . getReturnType ( ) ; fitReturnType = fitMethodArray [ i ] . getReturnType ( ) ; if ( onlyReturnType == fitReturnType ) { // if 2 methods have the same relevance and return type
throw new NoSuchMethodException ( Messages . getString ( "beans.62" , methodName ) ) ; // $ NON - NLS - 1 $
} if ( onlyReturnType . isAssignableFrom ( fitReturnType ) ) { // if onlyReturnType is super class or interface of
// fitReturnType , set onlyMethod to fitMethodArray [ i ]
onlyMethod = fitMethodArray [ i ] ; } } if ( difference > 0 ) { onlyMethod = fitMethodArray [ i ] ; } } return onlyMethod ; |
public class ExternalTaskEntity { /** * process failed state , make sure that binary entity is created for the errorMessage , shortError
* message does not exceed limit , handle properly retry counts and incidents
* @ param errorMessage - short error message text
* @ param errorDetails - full error details
* @ param retries - updated value of retries left
* @ param retryDuration - used for lockExpirationTime calculation */
public void failed ( String errorMessage , String errorDetails , int retries , long retryDuration ) { } } | ensureActive ( ) ; this . setErrorMessage ( errorMessage ) ; if ( errorDetails != null ) { setErrorDetails ( errorDetails ) ; } this . lockExpirationTime = new Date ( ClockUtil . getCurrentTime ( ) . getTime ( ) + retryDuration ) ; setRetriesAndManageIncidents ( retries ) ; produceHistoricExternalTaskFailedEvent ( ) ; |
public class vpnclientlessaccessprofile { /** * Use this API to delete vpnclientlessaccessprofile resources of given names . */
public static base_responses delete ( nitro_service client , String profilename [ ] ) throws Exception { } } | base_responses result = null ; if ( profilename != null && profilename . length > 0 ) { vpnclientlessaccessprofile deleteresources [ ] = new vpnclientlessaccessprofile [ profilename . length ] ; for ( int i = 0 ; i < profilename . length ; i ++ ) { deleteresources [ i ] = new vpnclientlessaccessprofile ( ) ; deleteresources [ i ] . profilename = profilename [ i ] ; } result = delete_bulk_request ( client , deleteresources ) ; } return result ; |
public class CmsReplaceDialog { /** * Creates the widget to display the selected file information . < p >
* @ param file the file info
* @ return the widget */
private CmsListItemWidget createFileWidget ( CmsFileInfo file ) { } } | String subTitle ; String resourceType = getResourceType ( file ) ; if ( file . getFileSize ( ) > 0 ) { subTitle = CmsUploadButton . formatBytes ( file . getFileSize ( ) ) + " (" + getResourceType ( file ) + ")" ; } else { subTitle = resourceType ; } CmsListInfoBean infoBean = new CmsListInfoBean ( file . getFileName ( ) , subTitle , null ) ; m_fileWidget = new CmsListItemWidget ( infoBean ) ; m_fileWidget . setIcon ( CmsCoreProvider . get ( ) . getResourceTypeIcon ( file ) ) ; checkFileType ( ) ; return m_fileWidget ; |
public class ApiOvhRouter { /** * Alter this object properties
* REST : PUT / router / { serviceName } / privateLink / { peerServiceName }
* @ param body [ required ] New object properties
* @ param serviceName [ required ] The internal name of your Router offer
* @ param peerServiceName [ required ] Service name of the other side of this link */
public void serviceName_privateLink_peerServiceName_PUT ( String serviceName , String peerServiceName , OvhPrivateLink body ) throws IOException { } } | String qPath = "/router/{serviceName}/privateLink/{peerServiceName}" ; StringBuilder sb = path ( qPath , serviceName , peerServiceName ) ; exec ( qPath , "PUT" , sb . toString ( ) , body ) ; |
public class KeyArea { /** * Move the physical binary data to this SQL parameter row .
* This is overidden to move the physical data type .
* @ param statement The SQL prepared statement .
* @ param iParamColumn Starting param column
* @ param iAreaDesc The key field area to get the values from .
* @ param bAddOnlyMods Add only modified fields ?
* @ return Next param column .
* @ exception SQLException From SQL calls . */
public int getSQLFromField ( PreparedStatement statement , int iType , int iParamColumn , int iAreaDesc , boolean bAddOnlyMods , boolean bIncludeTempFields ) throws SQLException { } } | boolean bForceUniqueKey = false ; int iKeyFieldCount = this . getKeyFields ( bForceUniqueKey , bIncludeTempFields ) ; for ( int iKeyFieldSeq = DBConstants . MAIN_KEY_FIELD ; iKeyFieldSeq < iKeyFieldCount ; iKeyFieldSeq ++ ) { KeyField keyField = this . getKeyField ( iKeyFieldSeq , bForceUniqueKey ) ; BaseField fieldParam = keyField . getField ( iAreaDesc ) ; if ( bAddOnlyMods ) if ( ! fieldParam . isModified ( ) ) continue ; // Skip this one
fieldParam . getSQLFromField ( statement , iType , iParamColumn ++ ) ; } return iParamColumn ; |
public class CommerceWishListLocalServiceWrapper { /** * Creates a new commerce wish list with the primary key . Does not add the commerce wish list to the database .
* @ param commerceWishListId the primary key for the new commerce wish list
* @ return the new commerce wish list */
@ Override public com . liferay . commerce . wish . list . model . CommerceWishList createCommerceWishList ( long commerceWishListId ) { } } | return _commerceWishListLocalService . createCommerceWishList ( commerceWishListId ) ; |
public class BootNode { /** * Put the node online on the model .
* @ param c the model to alter
* @ return { @ code true } iff the node was offline and is now online */
@ Override public boolean applyAction ( Model c ) { } } | if ( c . getMapping ( ) . isOffline ( node ) ) { c . getMapping ( ) . addOnlineNode ( node ) ; return true ; } return false ; |
public class WMenuItem { /** * { @ inheritDoc } */
@ Override public boolean isSelected ( ) { } } | WMenu menu = WebUtilities . getAncestorOfClass ( WMenu . class , this ) ; if ( menu != null ) { return menu . getSelectedMenuItems ( ) . contains ( this ) ; } return false ; |
public class FastAdapter { /** * adds a new event hook for an item
* NOTE : this has to be called before adding the first items , as this won ' t be called anymore after the ViewHolders were created
* @ param eventHook the event hook to be added for an item
* @ return this */
public FastAdapter < Item > withEventHook ( EventHook < Item > eventHook ) { } } | if ( eventHooks == null ) { eventHooks = new LinkedList < > ( ) ; } eventHooks . add ( eventHook ) ; return this ; |
public class ApiOvhDedicatedserver { /** * Get disk smart informations
* REST : GET / dedicated / server / { serviceName } / statistics / disk / { disk } / smart
* @ param serviceName [ required ] The internal name of your dedicated server
* @ param disk [ required ] Disk */
public OvhRtmDiskSmart serviceName_statistics_disk_disk_smart_GET ( String serviceName , String disk ) throws IOException { } } | String qPath = "/dedicated/server/{serviceName}/statistics/disk/{disk}/smart" ; StringBuilder sb = path ( qPath , serviceName , disk ) ; String resp = exec ( qPath , "GET" , sb . toString ( ) , null ) ; return convertTo ( resp , OvhRtmDiskSmart . class ) ; |
public class ExecPty { /** * There is only a 4 line output from ttytype - s :
* TERM = ' vt200 ' ; export TERM ;
* LINES = 47 ; export LINES ;
* COLUMNS = 112 ; export COLUMNS ;
* ERASE = ' ^ ? ' ; export ERASE ;
* @ param cfg input
* @ return size */
static Size doGetHPUXSize ( String cfg ) { } } | String [ ] tokens = cfg . split ( ";" ) ; return new Size ( Integer . parseInt ( tokens [ 4 ] . substring ( 9 ) ) , Integer . parseInt ( tokens [ 2 ] . substring ( 7 ) ) ) ; |
public class CssReader { /** * Read forward n characters , or until the next character is EOF .
* @ throws IOException */
CssReader forward ( int n ) throws IOException { } } | for ( int i = 0 ; i < n ; i ++ ) { // TODO escape awareness
Mark mark = mark ( ) ; next ( ) ; if ( curChar == - 1 ) { unread ( curChar , mark ) ; break ; } } return this ; |
public class AsynchronousRequest { /** * For more info on professions API go < a href = " https : / / wiki . guildwars2 . com / wiki / API : 2 / professions " > here < / a > < br / >
* Give user the access to { @ link Callback # onResponse ( Call , Response ) } and { @ link Callback # onFailure ( Call , Throwable ) } methods for custom interactions
* @ param ids list of profession id
* @ param callback callback that is going to be used for { @ link Call # enqueue ( Callback ) }
* @ throws GuildWars2Exception empty ID list
* @ throws NullPointerException if given { @ link Callback } is empty
* @ see Profession profession info */
public void getProfessionInfo ( String [ ] ids , Callback < List < Profession > > callback ) throws GuildWars2Exception , NullPointerException { } } | isParamValid ( new ParamChecker ( ids ) ) ; gw2API . getProfessionInfo ( processIds ( ids ) , GuildWars2 . lang . getValue ( ) ) . enqueue ( callback ) ; |
public class RouterChain { /** * 筛选Provider
* @ param request 本次调用 ( 可以得到类名 , 方法名 , 方法参数 , 参数值等 )
* @ param providerInfos providers ( < b > 当前可用 < / b > 的服务Provider列表 )
* @ return 路由匹配的服务Provider列表 */
public List < ProviderInfo > route ( SofaRequest request , List < ProviderInfo > providerInfos ) { } } | for ( Router router : routers ) { providerInfos = router . route ( request , providerInfos ) ; } return providerInfos ; |
public class WrappedConsumerSetChangeCallback { /** * Method consumerSetChange
* If the transition variable is negative at the point of invoking the callback ,
* then the callback is being called in order to signal that there are no longer
* any consumers for the expression on which the callback was registered . Similarly ,
* if transition is positive , then the callback is being called in order to signal that
* there are now consumers for the expression on which the callback was registered . If
* transition is zero , then no action need be taken .
* @ param isEmpty */
public synchronized void consumerSetChange ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "consumerSetChange" ) ; if ( transition < 0 ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Negative transition, isEmpty is true" ) ; callback . consumerSetChange ( true ) ; } else if ( transition > 0 ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Positive transition, isEmpty is false" ) ; callback . consumerSetChange ( false ) ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Zero transition, no callback" ) ; } // Set transition to zero
transition = 0 ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "consumerSetChange" ) ; |
public class TarEntry { /** * Initialization code common to all constructors . */
private void initialize ( ) { } } | this . file = null ; this . header = new TarHeader ( ) ; this . gnuFormat = false ; this . ustarFormat = true ; // REVIEW What we prefer to use . . .
this . unixFormat = false ; |
public class XBasePanel { /** * Code to display the side Menu .
* @ param out The http output stream .
* @ param reg Local resource bundle .
* @ exception DBException File exception . */
public void printXmlTrailer ( PrintWriter out , ResourceBundle reg ) throws DBException { } } | String strTrailer = reg . getString ( "xmlTrailer" ) ; if ( ( strTrailer == null ) || ( strTrailer . length ( ) == 0 ) ) strTrailer = " <trailer>" + " </trailer>" ; out . println ( strTrailer ) ; |
public class JenkinsServer { /** * Update the xml description of an existing job
* @ param folder the folder .
* @ param jobName the name of the job .
* @ param jobXml the job xml configuration .
* @ param crumbFlag true / false .
* @ throws IOException in case of an error . */
public JenkinsServer updateJob ( FolderJob folder , String jobName , String jobXml , boolean crumbFlag ) throws IOException { } } | client . post_xml ( UrlUtils . toJobBaseUrl ( folder , jobName ) + "/config.xml" , jobXml , crumbFlag ) ; return this ; |
public class WarsApi { /** * List wars Return a list of wars - - - This route is cached for up to 3600
* seconds
* @ param datasource
* The server name you would like data from ( optional , default to
* tranquility )
* @ param ifNoneMatch
* ETag from a previous request . A 304 will be returned if this
* matches the current ETag ( optional )
* @ param maxWarId
* Only return wars with ID smaller than this ( optional )
* @ return List & lt ; Integer & gt ;
* @ throws ApiException
* If fail to call the API , e . g . server error or cannot
* deserialize the response body */
public List < Integer > getWars ( String datasource , String ifNoneMatch , Integer maxWarId ) throws ApiException { } } | ApiResponse < List < Integer > > resp = getWarsWithHttpInfo ( datasource , ifNoneMatch , maxWarId ) ; return resp . getData ( ) ; |
public class HistoryDAO { /** * Gets the history for a user in the specified year and month
* year - the year in yyyy format
* month - the month in a year . . . values 1 - 12 */
public Result < List < Data > > readByUser ( AuthzTrans trans , String user , int ... yyyymm ) { } } | if ( yyyymm . length == 0 ) { return Result . err ( Status . ERR_BadData , "No or invalid yyyymm specified" ) ; } Result < ResultSet > rs = readByUser . exec ( trans , "user" , user ) ; if ( rs . notOK ( ) ) { return Result . err ( rs ) ; } return extract ( defLoader , rs . value , null , yyyymm . length > 0 ? new YYYYMM ( yyyymm ) : dflt ) ; |
public class KafkaMessageId { /** * Compares this { @ link KafkaMessageId } to { @ code id } . Comparison is made numerically , where the partition is
* considered more significant than the offset within the partition . The resulting ordering of
* { @ link KafkaMessageId } is identical to the ordering in a kafka partition .
* An instance is considered greater than { @ code null } .
* @ param id The { @ link KafkaMessageId } to compare with .
* @ return The result of { @ code 2 * signum ( partition - id . getPartition ( ) ) + signum ( offset - id . getOffset ( ) ) } or
* { @ code 1 } if { @ code id } is null . */
@ Override public int compareTo ( final KafkaMessageId id ) { } } | // instance is always > null
if ( id == null ) { return 1 ; } // use signum to perform the comparison , mark _ partition more significant than _ offset
return 2 * Integer . signum ( _partition - id . getPartition ( ) ) + Long . signum ( _offset - id . getOffset ( ) ) ; |
public class BeforeExpressionResolver { /** * Collects everything preceding the current JSF node within the same branch of the tree .
* It ' s like " @ previous previous : @ previous previous : @ previous : @ previous . . . " . */
public List < UIComponent > resolve ( UIComponent component , List < UIComponent > parentComponents , String currentId , String originalExpression , String [ ] parameters ) { } } | List < UIComponent > result = new ArrayList < UIComponent > ( ) ; for ( UIComponent parent : parentComponents ) { UIComponent grandparent = component . getParent ( ) ; for ( int i = 0 ; i < grandparent . getChildCount ( ) ; i ++ ) { if ( grandparent . getChildren ( ) . get ( i ) == parent ) { if ( i == 0 ) // if this is the first element of this component tree level there is no previous
throw new FacesException ( ERROR_MESSAGE + originalExpression ) ; // otherwise take the components before this one
while ( ( -- i ) >= 0 ) { result . add ( grandparent . getChildren ( ) . get ( i ) ) ; } return result ; } } } throw new FacesException ( ERROR_MESSAGE + originalExpression ) ; |
public class WorkflowsInner { /** * Gets a list of workflows by subscription .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the PagedList & lt ; WorkflowInner & gt ; object */
public Observable < Page < WorkflowInner > > listAsync ( ) { } } | return listWithServiceResponseAsync ( ) . map ( new Func1 < ServiceResponse < Page < WorkflowInner > > , Page < WorkflowInner > > ( ) { @ Override public Page < WorkflowInner > call ( ServiceResponse < Page < WorkflowInner > > response ) { return response . body ( ) ; } } ) ; |
public class Period { /** * Validates that the temporal has the correct chronology . */
private void validateChrono ( TemporalAccessor temporal ) { } } | Objects . requireNonNull ( temporal , "temporal" ) ; Chronology temporalChrono = temporal . query ( TemporalQueries . chronology ( ) ) ; if ( temporalChrono != null && IsoChronology . INSTANCE . equals ( temporalChrono ) == false ) { throw new DateTimeException ( "Chronology mismatch, expected: ISO, actual: " + temporalChrono . getId ( ) ) ; } |
public class QueryBuilder { /** * The quotient of two terms , as in { @ code WHERE k = left / right } . */
@ NonNull public static Term divide ( @ NonNull Term left , @ NonNull Term right ) { } } | return new BinaryArithmeticTerm ( ArithmeticOperator . QUOTIENT , left , right ) ; |
public class LineManager { /** * Set the LineCap property
* The display of line endings .
* @ param value property wrapper value around String */
public void setLineCap ( @ Property . LINE_CAP String value ) { } } | PropertyValue propertyValue = lineCap ( value ) ; constantPropertyUsageMap . put ( PROPERTY_LINE_CAP , propertyValue ) ; layer . setProperties ( propertyValue ) ; |
public class CrowdPeerManager { /** * from interface ChatProvider . ChatForwarder */
public boolean forwardTell ( UserMessage message , Name target , ChatService . TellListener listener ) { } } | // look up their auth username from their visible name
Name username = authFromViz ( target ) ; if ( username == null ) { return false ; // sorry kid , don ' t know ya
} // look through our peers to see if the target user is online on one of them
for ( PeerNode peer : _peers . values ( ) ) { CrowdNodeObject cnobj = ( CrowdNodeObject ) peer . nodeobj ; if ( cnobj == null ) { continue ; } // we have to use auth username to look up their ClientInfo
CrowdClientInfo cinfo = ( CrowdClientInfo ) cnobj . clients . get ( username ) ; if ( cinfo != null ) { cnobj . crowdPeerService . deliverTell ( message , target , listener ) ; return true ; } } return false ; |
public class GroupFilterMarshaller { /** * Marshall the given parameter object . */
public void marshall ( GroupFilter groupFilter , ProtocolMarshaller protocolMarshaller ) { } } | if ( groupFilter == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( groupFilter . getName ( ) , NAME_BINDING ) ; protocolMarshaller . marshall ( groupFilter . getValues ( ) , VALUES_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class Task { /** * Set a date value .
* @ param index date index ( 1-10)
* @ param value date value */
public void setDate ( int index , Date value ) { } } | set ( selectField ( TaskFieldLists . CUSTOM_DATE , index ) , value ) ; |
public class OAuth2AuthenticationFilter { /** * Checks to see if an error was returned by the OAuth Provider and throws an { @ link AuthenticationException } if
* it was .
* @ param parameters Parameters received from the OAuth Provider .
* @ throws AuthenticationException If an error was returned by the OAuth Provider . */
protected void checkForErrors ( Map < String , String [ ] > parameters ) throws AuthenticationException { } } | final String errorValues [ ] = parameters . get ( "error" ) ; final String errorReasonValues [ ] = parameters . get ( "error_reason" ) ; final String errorDescriptionValues [ ] = parameters . get ( "error_description" ) ; if ( errorValues != null && errorValues . length > 0 ) { final String error = errorValues [ 0 ] ; final String errorReason = errorReasonValues != null && errorReasonValues . length > 0 ? errorReasonValues [ 0 ] : null ; final String errorDescription = errorDescriptionValues != null && errorDescriptionValues . length > 0 ? errorDescriptionValues [ 0 ] : null ; final String errorText = String . format ( "An error was returned by the OAuth Provider: error=%s, " + "error_reason=%s, error_description=%s" , error , errorReason , errorDescription ) ; LOG . info ( errorText ) ; throw new AuthenticationServiceException ( errorText ) ; } |
public class DACC { /** * Initializes the method variables */
protected void initVariables ( ) { } } | int ensembleSize = ( int ) this . memberCountOption . getValue ( ) ; this . ensemble = new Classifier [ ensembleSize ] ; this . ensembleAges = new double [ ensembleSize ] ; this . ensembleWindows = new int [ ensembleSize ] [ ( int ) this . evaluationSizeOption . getValue ( ) ] ; |
public class ServerSetup { /** * Creates a copy with verbose mode enabled .
* @ param serverSetups the server setups .
* @ return copies of server setups with verbose mode enabled . */
public static ServerSetup [ ] verbose ( ServerSetup [ ] serverSetups ) { } } | ServerSetup [ ] copies = new ServerSetup [ serverSetups . length ] ; for ( int i = 0 ; i < serverSetups . length ; i ++ ) { copies [ i ] = serverSetups [ i ] . createCopy ( ) . setVerbose ( true ) ; } return copies ; |
public class Corc { /** * Gets the raw { @ link Writable } value for { @ code fieldName }
* @ throws IOException */
public Object getWritable ( String fieldName ) { } } | Object value = getValueMarshaller ( fieldName ) . getWritableObject ( struct ) ; LOG . debug ( "Fetched writable {}={}" , fieldName , value ) ; return value ; |
public class ResourceHandler { public void sendData ( HttpRequest request , HttpResponse response , String pathInContext , Resource resource , boolean writeHeaders ) throws IOException { } } | long resLength = resource . length ( ) ; // see if there are any range headers
Enumeration reqRanges = request . getDotVersion ( ) > 0 ? request . getFieldValues ( HttpFields . __Range ) : null ; if ( ! writeHeaders || reqRanges == null || ! reqRanges . hasMoreElements ( ) ) { // look for a gziped content .
Resource data = resource ; if ( _minGzipLength > 0 ) { String accept = request . getField ( HttpFields . __AcceptEncoding ) ; if ( accept != null && resLength > _minGzipLength && ! pathInContext . endsWith ( ".gz" ) ) { Resource gz = getHttpContext ( ) . getResource ( pathInContext + ".gz" ) ; if ( gz . exists ( ) && accept . indexOf ( "gzip" ) >= 0 ) { if ( log . isDebugEnabled ( ) ) log . debug ( "gzip=" + gz ) ; response . setField ( HttpFields . __ContentEncoding , "gzip" ) ; data = gz ; resLength = data . length ( ) ; } } } writeHeaders ( response , resource , resLength ) ; request . setHandled ( true ) ; OutputStream out = response . getOutputStream ( ) ; data . writeTo ( out , 0 , resLength ) ; return ; } // Parse the satisfiable ranges
List ranges = InclusiveByteRange . satisfiableRanges ( reqRanges , resLength ) ; if ( log . isDebugEnabled ( ) ) log . debug ( "ranges: " + reqRanges + " == " + ranges ) ; // if there are no satisfiable ranges , send 416 response
if ( ranges == null || ranges . size ( ) == 0 ) { log . debug ( "no satisfiable ranges" ) ; writeHeaders ( response , resource , resLength ) ; response . setStatus ( HttpResponse . __416_Requested_Range_Not_Satisfiable ) ; response . setReason ( ( String ) HttpResponse . __statusMsg . get ( TypeUtil . newInteger ( HttpResponse . __416_Requested_Range_Not_Satisfiable ) ) ) ; response . setField ( HttpFields . __ContentRange , InclusiveByteRange . to416HeaderRangeString ( resLength ) ) ; OutputStream out = response . getOutputStream ( ) ; resource . writeTo ( out , 0 , resLength ) ; request . setHandled ( true ) ; return ; } // if there is only a single valid range ( must be satisfiable
// since were here now ) , send that range with a 216 response
if ( ranges . size ( ) == 1 ) { InclusiveByteRange singleSatisfiableRange = ( InclusiveByteRange ) ranges . get ( 0 ) ; if ( log . isDebugEnabled ( ) ) log . debug ( "single satisfiable range: " + singleSatisfiableRange ) ; long singleLength = singleSatisfiableRange . getSize ( resLength ) ; writeHeaders ( response , resource , singleLength ) ; response . setStatus ( HttpResponse . __206_Partial_Content ) ; response . setReason ( ( String ) HttpResponse . __statusMsg . get ( TypeUtil . newInteger ( HttpResponse . __206_Partial_Content ) ) ) ; response . setField ( HttpFields . __ContentRange , singleSatisfiableRange . toHeaderRangeString ( resLength ) ) ; OutputStream out = response . getOutputStream ( ) ; resource . writeTo ( out , singleSatisfiableRange . getFirst ( resLength ) , singleLength ) ; request . setHandled ( true ) ; return ; } // multiple non - overlapping valid ranges cause a multipart
// 216 response which does not require an overall
// content - length header
ResourceCache . ResourceMetaData metaData = ( ResourceCache . ResourceMetaData ) resource . getAssociate ( ) ; String encoding = metaData . getMimeType ( ) ; MultiPartResponse multi = new MultiPartResponse ( response ) ; response . setStatus ( HttpResponse . __206_Partial_Content ) ; response . setReason ( ( String ) HttpResponse . __statusMsg . get ( TypeUtil . newInteger ( HttpResponse . __206_Partial_Content ) ) ) ; // If the request has a " Request - Range " header then we need to
// send an old style multipart / x - byteranges Content - Type . This
// keeps Netscape and acrobat happy . This is what Apache does .
String ctp ; if ( request . containsField ( HttpFields . __RequestRange ) ) ctp = "multipart/x-byteranges; boundary=" ; else ctp = "multipart/byteranges; boundary=" ; response . setContentType ( ctp + multi . getBoundary ( ) ) ; InputStream in = ( resource instanceof CachedResource ) ? null : resource . getInputStream ( ) ; OutputStream out = response . getOutputStream ( ) ; long pos = 0 ; for ( int i = 0 ; i < ranges . size ( ) ; i ++ ) { InclusiveByteRange ibr = ( InclusiveByteRange ) ranges . get ( i ) ; String header = HttpFields . __ContentRange + ": " + ibr . toHeaderRangeString ( resLength ) ; if ( log . isDebugEnabled ( ) ) log . debug ( "multi range: " + encoding + " " + header ) ; multi . startPart ( encoding , new String [ ] { header } ) ; long start = ibr . getFirst ( resLength ) ; long size = ibr . getSize ( resLength ) ; if ( in != null ) { // Handle non cached resource
if ( start < pos ) { in . close ( ) ; in = resource . getInputStream ( ) ; pos = 0 ; } if ( pos < start ) { in . skip ( start - pos ) ; pos = start ; } IO . copy ( in , out , size ) ; pos += size ; } else // Handle cached resource
resource . writeTo ( out , start , size ) ; } if ( in != null ) in . close ( ) ; multi . close ( ) ; request . setHandled ( true ) ; return ; |
public class Gauge { /** * Adds the given Section to the list of tickmark sections .
* @ param SECTION */
public void addTickMarkSection ( final Section SECTION ) { } } | if ( null == SECTION ) return ; tickMarkSections . add ( SECTION ) ; Collections . sort ( tickMarkSections , new SectionComparator ( ) ) ; fireUpdateEvent ( REDRAW_EVENT ) ; |
public class Configuration { /** * Gets all siblings with a defined prefix . Child properties will be not returned .
* < strong > Example : < / strong >
* { @ code getSiblings ( " writer " ) } will return properties with the keys { @ code writer } as well as { @ code writerTest }
* but not with the key { @ code writer . test } . Dots after a prefix ending with an at sign will be not handled as
* children . Therefore , { @ code getSiblings ( " level @ " ) } will return a property with the key { @ code level @ com . test } .
* @ param prefix
* Case - sensitive prefix for keys
* @ return All found properties ( map will be empty if there are no matching properties ) */
public static Map < String , String > getSiblings ( final String prefix ) { } } | Map < String , String > map = new HashMap < String , String > ( ) ; for ( Enumeration < Object > enumeration = properties . keys ( ) ; enumeration . hasMoreElements ( ) ; ) { String key = ( String ) enumeration . nextElement ( ) ; if ( key . startsWith ( prefix ) && ( prefix . endsWith ( "@" ) || key . indexOf ( '.' , prefix . length ( ) ) == - 1 ) ) { map . put ( key , ( String ) properties . get ( key ) ) ; } } return map ; |
public class Log { /** * Log long string using verbose tag
* @ param TAG The tag .
* @ param longString The long string . */
public static void logLong ( String TAG , String longString ) { } } | InputStream is = new ByteArrayInputStream ( longString . getBytes ( ) ) ; @ SuppressWarnings ( "resource" ) Scanner scan = new Scanner ( is ) ; while ( scan . hasNextLine ( ) ) { Log . v ( TAG , scan . nextLine ( ) ) ; } |
public class UdpContainerSettingsMarshaller { /** * Marshall the given parameter object . */
public void marshall ( UdpContainerSettings udpContainerSettings , ProtocolMarshaller protocolMarshaller ) { } } | if ( udpContainerSettings == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( udpContainerSettings . getM2tsSettings ( ) , M2TSSETTINGS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class GanttProjectReader { /** * This method extracts project properties from a GanttProject file .
* @ param ganttProject GanttProject file */
private void readProjectProperties ( Project ganttProject ) { } } | ProjectProperties mpxjProperties = m_projectFile . getProjectProperties ( ) ; mpxjProperties . setName ( ganttProject . getName ( ) ) ; mpxjProperties . setCompany ( ganttProject . getCompany ( ) ) ; mpxjProperties . setDefaultDurationUnits ( TimeUnit . DAYS ) ; String locale = ganttProject . getLocale ( ) ; if ( locale == null ) { locale = "en_US" ; } m_localeDateFormat = DateFormat . getDateInstance ( DateFormat . SHORT , new Locale ( locale ) ) ; |
public class ModelsImpl { /** * Adds a hierarchical entity extractor to the application version .
* @ param appId The application ID .
* @ param versionId The version ID .
* @ param hierarchicalModelCreateObject A model containing the name and children of the new entity extractor .
* @ param serviceCallback the async ServiceCallback to handle successful and failed responses .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceFuture } object */
public ServiceFuture < UUID > addHierarchicalEntityAsync ( UUID appId , String versionId , HierarchicalEntityModel hierarchicalModelCreateObject , final ServiceCallback < UUID > serviceCallback ) { } } | return ServiceFuture . fromResponse ( addHierarchicalEntityWithServiceResponseAsync ( appId , versionId , hierarchicalModelCreateObject ) , serviceCallback ) ; |
public class Wills { /** * Creates failed { @ link Will } using provided { @ link java . lang . Throwable }
* @ param throwable Will exception
* @ param < A > Type of Will
* @ return Created Will */
public static < A > Will < A > failedWill ( @ Nonnull Throwable throwable ) { } } | return new Of < A > ( Futures . < A > immediateFailedFuture ( throwable ) ) ; |
public class DescribeFileSystemsResult { /** * An array of file system descriptions .
* @ return An array of file system descriptions . */
public java . util . List < FileSystemDescription > getFileSystems ( ) { } } | if ( fileSystems == null ) { fileSystems = new com . amazonaws . internal . SdkInternalList < FileSystemDescription > ( ) ; } return fileSystems ; |
public class PersistentTimerHandle { /** * Write this object to the ObjectOutputStream .
* Note , this is overriding the default Serialize interface
* implementation .
* @ see java . io . Serializable */
private void writeObject ( java . io . ObjectOutputStream out ) throws IOException { } } | final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "writeObject: " + this ) ; out . defaultWriteObject ( ) ; // Write out header information first .
out . write ( EYECATCHER ) ; out . writeShort ( PLATFORM ) ; out . writeShort ( VERSION_ID ) ; // Write out the instance data .
out . writeBoolean ( isTimer ) ; out . writeLong ( taskId ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "writeObject" ) ; |
public class CommerceRegionPersistenceImpl { /** * Returns the commerce region where uuid = & # 63 ; and groupId = & # 63 ; or returns < code > null < / code > if it could not be found . Uses the finder cache .
* @ param uuid the uuid
* @ param groupId the group ID
* @ return the matching commerce region , or < code > null < / code > if a matching commerce region could not be found */
@ Override public CommerceRegion fetchByUUID_G ( String uuid , long groupId ) { } } | return fetchByUUID_G ( uuid , groupId , true ) ; |
public class BaseKdDao { /** * { @ inheritDoc } */
@ Override public void put ( String spaceId , String key , Map < String , Object > document , IPutCallback < Map < String , Object > > callback ) throws IOException { } } | kdStorage . put ( spaceId , key , document , new IPutCallback < Map < String , Object > > ( ) { @ Override public void onSuccess ( String spaceId , String key , Map < String , Object > entry ) { // invalidate cache upon successful deletion
invalidateCacheEntry ( spaceId , key , entry ) ; // invoke callback
callback . onSuccess ( spaceId , key , entry ) ; } @ Override public void onError ( String spaceId , String key , Map < String , Object > entry , Throwable t ) { // invoke callback
callback . onError ( spaceId , key , entry , t ) ; } } ) ; |
public class LazyInitProxyFactory { /** * Check if the object is of the special type { @ link org . ops4j . pax . wicket . spi . ReleasableProxyTarget } and return the target of this interface
* @ param target a { @ link java . lang . Object } object .
* @ return the parameter target or the target of the { @ link org . ops4j . pax . wicket . spi . ReleasableProxyTarget } if present */
public static Object getRealTarget ( Object target ) { } } | if ( target instanceof ProxyTarget ) { return ( ( ProxyTarget ) target ) . getTarget ( ) ; } return target ; |
public class PathNormalizer { /** * Normalizes a path and adds a separator at its start and its end .
* @ param path
* the path
* @ return the normalized path */
public static String asDirPath ( String path ) { } } | String dirPath = path ; if ( ! path . equals ( JawrConstant . URL_SEPARATOR ) ) { dirPath = JawrConstant . URL_SEPARATOR + normalizePath ( path ) + JawrConstant . URL_SEPARATOR ; } return dirPath ; |
public class DataUtil { /** * little - endian or intel format . */
public static void writeUnsignedIntegerLittleEndian ( IO . WritableByteStream io , long value ) throws IOException { } } | io . write ( ( byte ) ( value & 0xFF ) ) ; io . write ( ( byte ) ( ( value >> 8 ) & 0xFF ) ) ; io . write ( ( byte ) ( ( value >> 16 ) & 0xFF ) ) ; io . write ( ( byte ) ( ( value >> 24 ) & 0xFF ) ) ; |
public class RegxCriteria { /** * { @ inheritDoc } */
@ Override public void asSetter ( final StringBuilder sb ) { } } | sb . append ( ".setRegxCriteria(\"" ) ; sb . append ( patternParm ) ; sb . append ( "\")" ) ; |
public class AbstractTokenService { /** * If the passed token is null or expired , this method will throw an
* { @ link Exception } .
* @ param token
* @ throws Exception if the token is not valid ( e . g . because it is expired ) */
@ Transactional ( readOnly = true ) public void validateToken ( E token ) throws Exception { } } | if ( token == null ) { throw new Exception ( "The provided token is null." ) ; } DateTime expirationDate = ( DateTime ) token . getExpirationDate ( ) ; String tokenValue = token . getToken ( ) ; // check if the token expire date is valid
if ( expirationDate . isBeforeNow ( ) ) { throw new Exception ( "The token '" + tokenValue + "' expired on '" + expirationDate + "'" ) ; } |
public class IterableExtensions { /** * Returns a view on this iterable that provides at most the first < code > count < / code > entries .
* @ param iterable
* the iterable . May not be < code > null < / code > .
* @ param count
* the number of elements that should be returned at most .
* @ return an iterable with < code > count < / code > elements . Never < code > null < / code > .
* @ throws IllegalArgumentException
* if < code > count < / code > is negative . */
public static < T > Iterable < T > take ( final Iterable < T > iterable , final int count ) { } } | if ( iterable == null ) throw new NullPointerException ( "iterable" ) ; if ( count < 0 ) throw new IllegalArgumentException ( "Cannot take a negative number of elements. Argument 'count' was: " + count ) ; if ( count == 0 ) return Collections . emptyList ( ) ; return new Iterable < T > ( ) { @ Override public Iterator < T > iterator ( ) { return IteratorExtensions . take ( iterable . iterator ( ) , count ) ; } } ; |
public class SslProvider { /** * Remove Ssl support in the given client bootstrap
* @ param b a bootstrap to search and remove
* @ return passed { @ link Bootstrap } */
public static Bootstrap removeSslSupport ( Bootstrap b ) { } } | BootstrapHandlers . removeConfiguration ( b , NettyPipeline . SslHandler ) ; return b ; |
public class TraitComposer { /** * An utility method which tries to find a method with default implementation ( in the Java 8 semantics ) .
* @ param cNode a class node
* @ param name the name of the method
* @ param params the parameters of the method
* @ return a method node corresponding to a default method if it exists */
private static MethodNode findDefaultMethodFromInterface ( final ClassNode cNode , final String name , final Parameter [ ] params ) { } } | if ( cNode == null ) { return null ; } if ( cNode . isInterface ( ) ) { MethodNode method = cNode . getMethod ( name , params ) ; if ( method != null && ! method . isAbstract ( ) ) { // this is a Java 8 only behavior !
return method ; } } ClassNode [ ] interfaces = cNode . getInterfaces ( ) ; for ( ClassNode anInterface : interfaces ) { MethodNode res = findDefaultMethodFromInterface ( anInterface , name , params ) ; if ( res != null ) { return res ; } } return findDefaultMethodFromInterface ( cNode . getSuperClass ( ) , name , params ) ; |
public class AtlasClientV2 { /** * Bulk delete API for all types
* @ param typesDef A composite object that captures all types to be deleted */
public void deleteAtlasTypeDefs ( final AtlasTypesDef typesDef ) throws AtlasServiceException { } } | callAPI ( DELETE_ALL_TYPE_DEFS , AtlasTypesDef . class , AtlasType . toJson ( typesDef ) ) ; |
public class Dictionary { /** * Gets a property ' s value as an int .
* Floating point values will be rounded . The value ` true ` is returned as 1 , ` false ` as 0.
* Returns 0 if the value doesn ' t exist or does not have a numeric value .
* @ param key the key
* @ return the int value . */
@ Override public int getInt ( @ NonNull String key ) { } } | if ( key == null ) { throw new IllegalArgumentException ( "key cannot be null." ) ; } synchronized ( lock ) { return CBLConverter . asInteger ( getMValue ( internalDict , key ) , internalDict ) ; } |
public class Span { /** * Package private iterator method to access it as a Span . Iterator . */
Span . Iterator spanIterator ( ) { } } | if ( ! sorted ) { Collections . sort ( rows , new RowSeq . RowSeqComparator ( ) ) ; sorted = true ; } return new Span . Iterator ( ) ; |
public class ScheduledMetrics2Reporter { /** * Starts the reporter polling at the given period .
* @ param period the amount of time between polls
* @ param unit the unit for { @ code period } */
public void start ( long period , TimeUnit unit ) { } } | synchronized ( this ) { if ( started ) { throw new IllegalStateException ( "This reporter has already been started" ) ; } final long periodInMS = unit . toMillis ( period ) ; executor . scheduleAtFixedRate ( new Runnable ( ) { @ Override public void run ( ) { try { report ( ) ; } catch ( RuntimeException ex ) { logger . error ( "RuntimeException thrown from {}#report. Exception was suppressed." , ScheduledMetrics2Reporter . this . getClass ( ) . getSimpleName ( ) , ex ) ; } } } , getOffsetUntilTimestampIsDivisableByPeriod ( clock . getTime ( ) , periodInMS ) , periodInMS , TimeUnit . MILLISECONDS ) ; this . clock = new QuantizedClock ( clock , periodInMS ) ; this . started = true ; } |
public class Numerizer { /** * string . gsub ! ( / + | ( [ ^ \ d ] ) - ( [ ^ \ \ d ] ) / , ' \ 1 \ 2 ' ) # will mutilate hyphenated - words but shouldn ' t matter for date extraction */
public static String numerize ( String str ) { } } | String numerizedStr = str ; // preprocess
numerizedStr = Numerizer . DEHYPHENATOR . matcher ( numerizedStr ) . replaceAll ( "$1 $2" ) ; // will mutilate hyphenated - words but shouldn ' t matter for date extraction
numerizedStr = Numerizer . DEHALFER . matcher ( numerizedStr ) . replaceAll ( "haAlf" ) ; // take the ' a ' out so it doesn ' t turn into a 1 , save the half for the end
// easy / direct replacements
for ( DirectNum dn : Numerizer . DIRECT_NUMS ) { numerizedStr = dn . getName ( ) . matcher ( numerizedStr ) . replaceAll ( dn . getNumber ( ) ) ; } // ten , twenty , etc .
for ( Prefix tp : Numerizer . TEN_PREFIXES ) { Matcher matcher = tp . getName ( ) . matcher ( numerizedStr ) ; if ( matcher . find ( ) ) { StringBuffer matcherBuffer = new StringBuffer ( ) ; do { if ( matcher . group ( 1 ) == null ) { matcher . appendReplacement ( matcherBuffer , String . valueOf ( tp . getNumber ( ) ) ) ; } else { matcher . appendReplacement ( matcherBuffer , String . valueOf ( tp . getNumber ( ) + Long . parseLong ( matcher . group ( 1 ) . trim ( ) ) ) ) ; } } while ( matcher . find ( ) ) ; matcher . appendTail ( matcherBuffer ) ; numerizedStr = matcherBuffer . toString ( ) ; } } // hundreds , thousands , millions , etc .
for ( Prefix bp : Numerizer . BIG_PREFIXES ) { Matcher matcher = bp . getName ( ) . matcher ( numerizedStr ) ; if ( matcher . find ( ) ) { StringBuffer matcherBuffer = new StringBuffer ( ) ; do { if ( matcher . group ( 1 ) == null ) { matcher . appendReplacement ( matcherBuffer , String . valueOf ( bp . getNumber ( ) ) ) ; } else { matcher . appendReplacement ( matcherBuffer , String . valueOf ( bp . getNumber ( ) * Long . parseLong ( matcher . group ( 1 ) . trim ( ) ) ) ) ; } } while ( matcher . find ( ) ) ; matcher . appendTail ( matcherBuffer ) ; numerizedStr = matcherBuffer . toString ( ) ; numerizedStr = Numerizer . andition ( numerizedStr ) ; // combine _ numbers ( string ) / / Should to be more efficient way to do this
} } // fractional addition
// I ' m not combining this with the previous block as using float addition complicates the strings
// ( with extraneous . 0 ' s and such )
Matcher matcher = Numerizer . DEHAALFER . matcher ( numerizedStr ) ; if ( matcher . find ( ) ) { StringBuffer matcherBuffer = new StringBuffer ( ) ; do { matcher . appendReplacement ( matcherBuffer , String . valueOf ( Float . parseFloat ( matcher . group ( 1 ) . trim ( ) ) + 0.5f ) ) ; } while ( matcher . find ( ) ) ; matcher . appendTail ( matcherBuffer ) ; numerizedStr = matcherBuffer . toString ( ) ; } // string . gsub ! ( / ( \ d + ) ( ? : | and | - ) * haAlf / i ) { ( $ 1 . to _ f + 0.5 ) . to _ s }
return numerizedStr ; |
public class ServerOperations { /** * Parses the result and returns the failure description . If the result was successful , an empty string is
* returned .
* @ param result the result of executing an operation
* @ return the failure message or an empty string */
public static String getFailureDescriptionAsString ( final ModelNode result ) { } } | if ( isSuccessfulOutcome ( result ) ) { return "" ; } final String msg ; if ( result . hasDefined ( ClientConstants . FAILURE_DESCRIPTION ) ) { if ( result . hasDefined ( ClientConstants . OP ) ) { msg = String . format ( "Operation '%s' at address '%s' failed: %s" , result . get ( ClientConstants . OP ) , result . get ( ClientConstants . OP_ADDR ) , result . get ( ClientConstants . FAILURE_DESCRIPTION ) ) ; } else { msg = String . format ( "Operation failed: %s" , result . get ( ClientConstants . FAILURE_DESCRIPTION ) ) ; } } else { msg = String . format ( "An unexpected response was found checking the deployment. Result: %s" , result ) ; } return msg ; |
public class LightWeightHashSet { /** * Add given element to the hash table
* @ return true if the element was not present in the table , false otherwise */
protected boolean addElem ( final T element ) { } } | // validate element
if ( element == null ) { throw new IllegalArgumentException ( "Null element is not supported." ) ; } // find hashCode & index
final int hashCode = element . hashCode ( ) ; final int index = getIndex ( hashCode ) ; // return false if already present
if ( containsElem ( index , element , hashCode ) ) { return false ; } modification ++ ; size ++ ; // update bucket linked list
LinkedElement < T > le = new LinkedElement < T > ( element , hashCode ) ; le . next = entries [ index ] ; entries [ index ] = le ; return true ; |
public class SipStack { /** * FOR INTERNAL USE ONLY . Not to be used by a test program . */
public void processResponse ( ResponseEvent arg0 ) { } } | synchronized ( listeners ) { if ( ( ( ResponseEventExt ) arg0 ) . isRetransmission ( ) ) retransmissions ++ ; Iterator iter = listeners . iterator ( ) ; while ( iter . hasNext ( ) == true ) { SipListener listener = ( SipListener ) iter . next ( ) ; listener . processResponse ( arg0 ) ; } } |
public class sslservicegroup { /** * Use this API to update sslservicegroup . */
public static base_response update ( nitro_service client , sslservicegroup resource ) throws Exception { } } | sslservicegroup updateresource = new sslservicegroup ( ) ; updateresource . servicegroupname = resource . servicegroupname ; updateresource . sessreuse = resource . sessreuse ; updateresource . sesstimeout = resource . sesstimeout ; updateresource . nonfipsciphers = resource . nonfipsciphers ; updateresource . ssl3 = resource . ssl3 ; updateresource . tls1 = resource . tls1 ; updateresource . serverauth = resource . serverauth ; updateresource . commonname = resource . commonname ; updateresource . sendclosenotify = resource . sendclosenotify ; return updateresource . update_resource ( client ) ; |
public class ListObjectAttributesRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ListObjectAttributesRequest listObjectAttributesRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( listObjectAttributesRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( listObjectAttributesRequest . getDirectoryArn ( ) , DIRECTORYARN_BINDING ) ; protocolMarshaller . marshall ( listObjectAttributesRequest . getObjectReference ( ) , OBJECTREFERENCE_BINDING ) ; protocolMarshaller . marshall ( listObjectAttributesRequest . getNextToken ( ) , NEXTTOKEN_BINDING ) ; protocolMarshaller . marshall ( listObjectAttributesRequest . getMaxResults ( ) , MAXRESULTS_BINDING ) ; protocolMarshaller . marshall ( listObjectAttributesRequest . getConsistencyLevel ( ) , CONSISTENCYLEVEL_BINDING ) ; protocolMarshaller . marshall ( listObjectAttributesRequest . getFacetFilter ( ) , FACETFILTER_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class MapLayer { /** * Replies if this layer was mark as temporary lyer .
* < p > A temporary layer means that any things inside this layer is
* assumed to be lost when the layer will be destroyed .
* @ return < code > true < / code > if this layer is temporary , otherwise < code > false < / code > */
@ Pure public final boolean isTemporaryLayer ( ) { } } | MapLayer layer = this ; GISLayerContainer < ? > container ; while ( layer != null ) { if ( layer . isTemp ) { return true ; } container = layer . getContainer ( ) ; layer = container instanceof MapLayer ? ( MapLayer ) container : null ; } return false ; |
public class HttpServerReefEventHandler { /** * Write Evaluator info on the Response so that to display on web page directly .
* This is for direct browser queries . */
private void writeEvaluatorInfoWebOutput ( final HttpServletResponse response , final List < String > ids ) throws IOException { } } | for ( final String id : ids ) { final EvaluatorDescriptor evaluatorDescriptor = this . reefStateManager . getEvaluators ( ) . get ( id ) ; final PrintWriter writer = response . getWriter ( ) ; if ( evaluatorDescriptor != null ) { final String nodeId = evaluatorDescriptor . getNodeDescriptor ( ) . getId ( ) ; final String nodeName = evaluatorDescriptor . getNodeDescriptor ( ) . getName ( ) ; final InetSocketAddress address = evaluatorDescriptor . getNodeDescriptor ( ) . getInetSocketAddress ( ) ; writer . println ( "Evaluator Id: " + id ) ; writer . write ( "<br/>" ) ; writer . println ( "Evaluator Node Id: " + nodeId ) ; writer . write ( "<br/>" ) ; writer . println ( "Evaluator Node Name: " + nodeName ) ; writer . write ( "<br/>" ) ; writer . println ( "Evaluator InternetAddress: " + address ) ; writer . write ( "<br/>" ) ; writer . println ( "Evaluator Memory: " + evaluatorDescriptor . getMemory ( ) ) ; writer . write ( "<br/>" ) ; writer . println ( "Evaluator Core: " + evaluatorDescriptor . getNumberOfCores ( ) ) ; writer . write ( "<br/>" ) ; writer . println ( "Evaluator Type: " + evaluatorDescriptor . getProcess ( ) ) ; writer . write ( "<br/>" ) ; writer . println ( "Evaluator Runtime Name: " + evaluatorDescriptor . getRuntimeName ( ) ) ; writer . write ( "<br/>" ) ; } else { writer . println ( "Incorrect Evaluator Id: " + id ) ; } } |
public class GetStageResult { /** * Route settings for the stage .
* @ param routeSettings
* Route settings for the stage .
* @ return Returns a reference to this object so that method calls can be chained together . */
public GetStageResult withRouteSettings ( java . util . Map < String , RouteSettings > routeSettings ) { } } | setRouteSettings ( routeSettings ) ; return this ; |
public class JqmEngine { /** * Starts the engine
* @ param nodeName
* the name of the node to start , as in the NODE table of the database .
* @ throws JqmInitError */
void start ( String nodeName , JqmEngineHandler h ) { } } | if ( nodeName == null || nodeName . isEmpty ( ) ) { throw new IllegalArgumentException ( "nodeName cannot be null or empty" ) ; } this . handler = h ; // Set thread name - used in audits
Thread . currentThread ( ) . setName ( "JQM engine;;" + nodeName ) ; // First event
if ( this . handler != null ) { this . handler . onNodeStarting ( nodeName ) ; } // Log : we are starting . . .
jqmlogger . info ( "JQM engine version " + this . getVersion ( ) + " for node " + nodeName + " is starting" ) ; jqmlogger . info ( "Java version is " + System . getProperty ( "java.version" ) + ". JVM was made by " + System . getProperty ( "java.vendor" ) + " as " + System . getProperty ( "java.vm.name" ) + " version " + System . getProperty ( "java.vm.version" ) ) ; // JNDI first - the engine itself uses JNDI to fetch its connections !
Helpers . registerJndiIfNeeded ( ) ; // Database connection
DbConn cnx = Helpers . getNewDbSession ( ) ; cnx . logDatabaseInfo ( jqmlogger ) ; // Node configuration is in the database
try { node = Node . select_single ( cnx , "node_select_by_key" , nodeName ) ; } catch ( NoResultException e ) { throw new JqmRuntimeException ( "the specified node name [" + nodeName + "] does not exist in the configuration. Please create this node before starting it" , e ) ; } // Check if double - start
long toWait = ( long ) ( 1.1 * Long . parseLong ( GlobalParameter . getParameter ( cnx , "internalPollingPeriodMs" , "60000" ) ) ) ; if ( node . getLastSeenAlive ( ) != null && Calendar . getInstance ( ) . getTimeInMillis ( ) - node . getLastSeenAlive ( ) . getTimeInMillis ( ) <= toWait ) { long r = Calendar . getInstance ( ) . getTimeInMillis ( ) - node . getLastSeenAlive ( ) . getTimeInMillis ( ) ; throw new JqmInitErrorTooSoon ( "Another engine named " + nodeName + " was running less than " + r / 1000 + " seconds ago. Either stop the other node, or if it already stopped, please wait " + ( toWait - r ) / 1000 + " seconds" ) ; } SimpleDateFormat ft = new SimpleDateFormat ( "dd/MM/YYYY hh:mm:ss" ) ; jqmlogger . debug ( "The last time an engine with this name was seen was: " + ( node . getLastSeenAlive ( ) == null ? "" : ft . format ( node . getLastSeenAlive ( ) . getTime ( ) ) ) ) ; // Prevent very quick multiple starts by immediately setting the keep - alive
QueryResult qr = cnx . runUpdate ( "node_update_alive_by_id" , node . getId ( ) ) ; cnx . commit ( ) ; if ( qr . nbUpdated == 0 ) { throw new JqmInitErrorTooSoon ( "Another engine named " + nodeName + " is running" ) ; } // Only start if the node configuration seems OK
Helpers . checkConfiguration ( nodeName , cnx ) ; // Log parameters
Helpers . dumpParameters ( cnx , node ) ; // The handler may take any actions it wishes here - such as setting log levels , starting Jetty . . .
if ( this . handler != null ) { this . handler . onNodeConfigurationRead ( node ) ; } // Remote JMX server
if ( node . getJmxRegistryPort ( ) != null && node . getJmxServerPort ( ) != null && node . getJmxRegistryPort ( ) > 0 && node . getJmxServerPort ( ) > 0 ) { JmxAgent . registerAgent ( node . getJmxRegistryPort ( ) , node . getJmxServerPort ( ) , node . getDns ( ) ) ; } else { jqmlogger . info ( "JMX remote listener will not be started as JMX registry port and JMX server port parameters are not both defined" ) ; } // JMX
if ( node . getJmxServerPort ( ) != null && node . getJmxServerPort ( ) > 0 ) { try { MBeanServer mbs = ManagementFactory . getPlatformMBeanServer ( ) ; name = new ObjectName ( "com.enioka.jqm:type=Node,name=" + this . node . getName ( ) ) ; mbs . registerMBean ( this , name ) ; } catch ( Exception e ) { throw new JqmInitError ( "Could not create JMX beans" , e ) ; } jqmlogger . info ( "JMX management bean for the engine was registered" ) ; } else { loadJmxBeans = false ; jqmlogger . info ( "JMX management beans will not be loaded as JMX server port is null or zero" ) ; } // Security
if ( System . getSecurityManager ( ) == null ) { System . setSecurityManager ( new SecurityManagerPayload ( ) ) ; } jqmlogger . info ( "Security manager was registered" ) ; // Scheduler
scheduler = new CronScheduler ( this ) ; // Cleanup
purgeDeadJobInstances ( cnx , this . node ) ; // Runners
runningJobInstanceManager = new RunningJobInstanceManager ( ) ; runnerManager = new RunnerManager ( cnx ) ; // Resource managers
initResourceManagers ( cnx ) ; // Pollers
syncPollers ( cnx , this . node ) ; jqmlogger . info ( "All required queues are now polled" ) ; // Internal poller ( stop notifications , keep alive )
intPoller = new InternalPoller ( this ) ; intPollerThread = new Thread ( intPoller ) ; intPollerThread . start ( ) ; // Kill notifications
killHook = new SignalHandler ( this ) ; Runtime . getRuntime ( ) . addShutdownHook ( killHook ) ; // Done
cnx . close ( ) ; cnx = null ; JqmEngine . latestNodeStartedName = node . getName ( ) ; if ( this . handler != null ) { this . handler . onNodeStarted ( ) ; } jqmlogger . info ( "End of JQM engine initialization" ) ; |
public class CmsHighlightingBorder { /** * Recalculates the position and dimension when a positioning parent is given . < p > */
public void resetPosition ( ) { } } | // fail if no positioning parent given
assert m_positioningParent != null ; if ( m_positioningParent != null ) { setPosition ( m_positioningParent . getOffsetHeight ( ) , m_positioningParent . getOffsetWidth ( ) , 0 , 0 ) ; } |
public class CmsHistoryRow { /** * Gets the file version . < p >
* @ return the file version */
@ Column ( header = org . opencms . workplace . commons . Messages . GUI_LABEL_VERSION_0 , order = 30 ) public String getVersion ( ) { } } | return formatVersion ( m_bean ) ; |
public class TargetVpnGatewayClient { /** * Returns the specified target VPN gateway . Gets a list of available target VPN gateways by
* making a list ( ) request .
* < p > Sample code :
* < pre > < code >
* try ( TargetVpnGatewayClient targetVpnGatewayClient = TargetVpnGatewayClient . create ( ) ) {
* ProjectRegionTargetVpnGatewayName targetVpnGateway = ProjectRegionTargetVpnGatewayName . of ( " [ PROJECT ] " , " [ REGION ] " , " [ TARGET _ VPN _ GATEWAY ] " ) ;
* TargetVpnGateway response = targetVpnGatewayClient . getTargetVpnGateway ( targetVpnGateway ) ;
* < / code > < / pre >
* @ param targetVpnGateway Name of the target VPN gateway to return .
* @ throws com . google . api . gax . rpc . ApiException if the remote call fails */
@ BetaApi public final TargetVpnGateway getTargetVpnGateway ( ProjectRegionTargetVpnGatewayName targetVpnGateway ) { } } | GetTargetVpnGatewayHttpRequest request = GetTargetVpnGatewayHttpRequest . newBuilder ( ) . setTargetVpnGateway ( targetVpnGateway == null ? null : targetVpnGateway . toString ( ) ) . build ( ) ; return getTargetVpnGateway ( request ) ; |
public class ResourceDataSource { /** * Get output stream .
* @ returns Output stream
* @ throws IOException IO exception occurred */
@ Override public OutputStream getOutputStream ( ) throws IOException { } } | if ( ! _file . isWriteable ( ) ) { throw new IOException ( "Cannot write" ) ; } return IOUtil . toBufferedOutputStream ( _file . getOutputStream ( ) ) ; |
public class FormModelFactory { /** * Create a child form model nested by this form model identified by the
* provided name . The form object associated with the created child model is
* the value model at the specified parent property path .
* @ param parentModel the model to create the FormModelFactory in
* @ param childPageName the name to associate the created FormModelFactory
* with in the groupingModel
* @ param childFormObjectPropertyPath the path into the groupingModel that
* the FormModelFactory is for
* @ return The child form model */
public ValidatingFormModel createChildPageFormModel ( HierarchicalFormModel parentModel , String childPageName , String childFormObjectPropertyPath ) { } } | final ValueModel childValueModel = parentModel . getValueModel ( childFormObjectPropertyPath ) ; return createChildPageFormModel ( parentModel , childPageName , childValueModel ) ; |
public class Util { /** * In Liberty a single GSSToken is created . */
@ Sensitive public static byte [ ] encodeLTPAToken ( Codec codec , @ Sensitive byte [ ] ltpaTokenBytes ) { } } | byte [ ] result = null ; try { // create and encode the initial context token
Any a = ORB . init ( ) . create_any ( ) ; OpaqueHelper . insert ( a , ltpaTokenBytes ) ; byte [ ] init_ctx_token = codec . encode_value ( a ) ; result = createGSSToken ( codec , LTPAMech . LTPA_OID , init_ctx_token ) ; } catch ( Exception ex ) { // do nothing , return null
} return result ; |
public class HTTPClientResponseFetcher { /** * Get the body .
* @ param entity the http entity from the response
* @ param enc the encoding
* @ return the body as a String
* @ throws IOException if the body couldn ' t be fetched */
protected String getBody ( HttpEntity entity , String enc ) throws IOException { } } | final StringBuilder body = new StringBuilder ( ) ; String buffer = "" ; if ( entity != null ) { final BufferedReader reader = new BufferedReader ( new InputStreamReader ( entity . getContent ( ) , enc ) ) ; while ( ( buffer = reader . readLine ( ) ) != null ) { body . append ( buffer ) ; } reader . close ( ) ; } return body . toString ( ) ; |
public class SQLiteConnection { /** * Collects statistics about database connection memory usage .
* @ param dbStatsList The list to populate . */
void collectDbStats ( ArrayList < DbStats > dbStatsList ) { } } | // Get information about the main database .
int lookaside = nativeGetDbLookaside ( mConnectionPtr ) ; long pageCount = 0 ; long pageSize = 0 ; try { pageCount = executeForLong ( "PRAGMA page_count;" , null , null ) ; pageSize = executeForLong ( "PRAGMA page_size;" , null , null ) ; } catch ( SQLiteException ex ) { // Ignore .
} dbStatsList . add ( getMainDbStatsUnsafe ( lookaside , pageCount , pageSize ) ) ; // Get information about attached databases .
// We ignore the first row in the database list because it corresponds to
// the main database which we have already described .
CursorWindow window = new CursorWindow ( "collectDbStats" ) ; try { executeForCursorWindow ( "PRAGMA database_list;" , null , window , 0 , 0 , false , null ) ; for ( int i = 1 ; i < window . getNumRows ( ) ; i ++ ) { String name = window . getString ( i , 1 ) ; String path = window . getString ( i , 2 ) ; pageCount = 0 ; pageSize = 0 ; try { pageCount = executeForLong ( "PRAGMA " + name + ".page_count;" , null , null ) ; pageSize = executeForLong ( "PRAGMA " + name + ".page_size;" , null , null ) ; } catch ( SQLiteException ex ) { // Ignore .
} String label = " (attached) " + name ; if ( ! path . isEmpty ( ) ) { label += ": " + path ; } dbStatsList . add ( new DbStats ( label , pageCount , pageSize , 0 , 0 , 0 , 0 ) ) ; } } catch ( SQLiteException ex ) { // Ignore .
} finally { window . close ( ) ; } |
public class TDefinitions { /** * Implementing support for internal model */
@ Override public List < DecisionService > getDecisionService ( ) { } } | return drgElement . stream ( ) . filter ( DecisionService . class :: isInstance ) . map ( DecisionService . class :: cast ) . collect ( Collectors . toList ( ) ) ; |
public class SpyRandomAccessStream { /** * Reads a block from a given location . */
public int read ( byte [ ] buffer , int offset , int length ) throws IOException { } } | log . finest ( "random-read(0x" + Long . toHexString ( getFilePointer ( ) ) + "," + length + ")" ) ; return _file . read ( buffer , offset , length ) ; |
public class BufferUtil { /** * Sane ByteBuffer slice
* @ param buf the buffer to slice something out of
* @ param off The offset into the buffer
* @ param len the length of the part to slice out */
public static ByteBuffer slice ( ByteBuffer buf , int off , int len ) { } } | ByteBuffer localBuf = buf . duplicate ( ) ; // so we don ' t mess up the position , etc
logger . debug ( "off={} len={}" , off , len ) ; localBuf . position ( off ) ; localBuf . limit ( off + len ) ; logger . debug ( "pre-slice: localBuf.position()={} localBuf.limit()={}" , localBuf . position ( ) , localBuf . limit ( ) ) ; localBuf = localBuf . slice ( ) ; logger . debug ( "post-slice: localBuf.position()={} localBuf.limit()={}" , localBuf . position ( ) , localBuf . limit ( ) ) ; return localBuf ; |
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link RailwayType } { @ code > }
* @ param value
* Java instance representing xml element ' s value .
* @ return
* the new instance of { @ link JAXBElement } { @ code < } { @ link RailwayType } { @ code > } */
@ XmlElementDecl ( namespace = "http://www.opengis.net/citygml/transportation/2.0" , name = "Railway" , substitutionHeadNamespace = "http://www.opengis.net/citygml/transportation/2.0" , substitutionHeadName = "TransportationComplex" ) public JAXBElement < RailwayType > createRailway ( RailwayType value ) { } } | return new JAXBElement < RailwayType > ( _Railway_QNAME , RailwayType . class , null , value ) ; |
public class ExportModuleNameCompilerPass { /** * Recursively called to process AST nodes looking for anonymous define calls . If an
* anonymous define call is found , then change it be a named define call , specifying
* the module name for the file being processed .
* @ param node
* The node being processed */
public void processChildren ( Node node ) { } } | for ( Node cursor = node . getFirstChild ( ) ; cursor != null ; cursor = cursor . getNext ( ) ) { if ( cursor . getType ( ) == Token . CALL ) { // The node is a function or method call
Node name = cursor . getFirstChild ( ) ; if ( name != null && name . getType ( ) == Token . NAME && // named function call
name . getString ( ) . equals ( "define" ) ) { // name is " define " / / $ NON - NLS - 1 $
Node param = name . getNext ( ) ; if ( param != null && param . getType ( ) != Token . STRING ) { String expname = name . getProp ( Node . SOURCENAME_PROP ) . toString ( ) ; if ( source != null ) { PositionLocator locator = source . locate ( name . getLineno ( ) , name . getCharno ( ) + 6 ) ; char tok = locator . findNextJSToken ( ) ; // move cursor to the open paren
if ( tok == '(' ) { // Try to insert the module name immediately following the open paren for the
// define call because the param location will be off if the argument list is parenthesized .
source . insert ( "\"" + expname + "\"," , locator . getLineno ( ) , locator . getCharno ( ) + 1 ) ; // $ NON - NLS - 1 $ / / $ NON - NLS - 2 $
} else { // First token following ' define ' name is not a paren , so fall back to inserting
// before the first parameter .
source . insert ( "\"" + expname + "\"," , param . getLineno ( ) , param . getCharno ( ) ) ; // $ NON - NLS - 1 $ / / $ NON - NLS - 2 $
} } param . getParent ( ) . addChildBefore ( Node . newString ( expname ) , param ) ; } } } // Recursively call this method to process the child nodes
if ( cursor . hasChildren ( ) ) processChildren ( cursor ) ; } |
public class BindingsHelper { /** * A method for obtaining a Binding Name Helper for use with the remote jndi namespace .
* @ param homeRecord The HomeRecord associated with the bean whose interfaces or home are to
* have jndi binding name ( s ) constructed .
* @ return an instance of a BindingsHelper for generating jndi names intended to be bound into
* the remote jndi namespace . */
public static BindingsHelper getRemoteHelper ( HomeRecord homeRecord ) { } } | if ( homeRecord . ivRemoteBindingsHelper == null ) { homeRecord . ivRemoteBindingsHelper = new BindingsHelper ( homeRecord , cvAllRemoteBindings , "ejb/" ) ; } return homeRecord . ivRemoteBindingsHelper ; |
public class AbstractPeriod { /** * Gets an array of the field types that this period supports .
* The fields are returned largest to smallest , for example Hours , Minutes , Seconds .
* @ return the fields supported in an array that may be altered , largest to smallest */
public DurationFieldType [ ] getFieldTypes ( ) { } } | DurationFieldType [ ] result = new DurationFieldType [ size ( ) ] ; for ( int i = 0 ; i < result . length ; i ++ ) { result [ i ] = getFieldType ( i ) ; } return result ; |
public class FJIterate { /** * Same effect as { @ link Iterate # count ( Iterable , Predicate ) } , but executed in parallel batches .
* @ return The number of elements which satisfy the Predicate . */
public static < T > int count ( Iterable < T > iterable , Predicate < ? super T > predicate ) { } } | return count ( iterable , predicate , FJIterate . DEFAULT_MIN_FORK_SIZE , FJIterate . FORK_JOIN_POOL ) ; |
public class LogBuffer { /** * Return next 24 - bit unsigned int from buffer . ( little - endian )
* @ see mysql - 5.1.60 / include / my _ global . h - uint3korr */
public final int getUint24 ( ) { } } | if ( position + 2 >= origin + limit ) throw new IllegalArgumentException ( "limit excceed: " + ( position - origin + 2 ) ) ; byte [ ] buf = buffer ; return ( 0xff & buf [ position ++ ] ) | ( ( 0xff & buf [ position ++ ] ) << 8 ) | ( ( 0xff & buf [ position ++ ] ) << 16 ) ; |
public class Interface { /** * Use this API to enable Interface of given name . */
public static base_response enable ( nitro_service client , String id ) throws Exception { } } | Interface enableresource = new Interface ( ) ; enableresource . id = id ; return enableresource . perform_operation ( client , "enable" ) ; |