signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class JFreeChartExporter { /** * replace $ P { . . . } parameters ( used in title and x , y legends */ private String replaceParameters ( String text ) { } }
if ( text == null ) { return null ; } for ( String param : parameterValues . keySet ( ) ) { text = StringUtil . replace ( text , "\\$P\\{" + param + "\\}" , StringUtil . getValueAsString ( parameterValues . get ( param ) , null , I18nUtil . getLanguageByName ( chart , language ) ) ) ; } return text ;
public class SyncListItemReader { /** * Add the requested query string arguments to the Request . * @ param request Request to add query string arguments to */ private void addQueryParams ( final Request request ) { } }
if ( order != null ) { request . addQueryParam ( "Order" , order . toString ( ) ) ; } if ( from != null ) { request . addQueryParam ( "From" , from ) ; } if ( bounds != null ) { request . addQueryParam ( "Bounds" , bounds . toString ( ) ) ; } if ( getPageSize ( ) != null ) { request . addQueryParam ( "PageSize" , Integer . toString ( getPageSize ( ) ) ) ; }
public class BizLoggerFactory { /** * 保证一个TaskTracker只能有一个Logger , 因为一个jvm可以有多个TaskTracker */ public static BizLogger getLogger ( Level level , RemotingClientDelegate remotingClient , TaskTrackerAppContext appContext ) { } }
// 单元测试的时候返回 Mock if ( Environment . UNIT_TEST == LTSConfig . getEnvironment ( ) ) { return new MockBizLogger ( level ) ; } String key = appContext . getConfig ( ) . getIdentity ( ) ; BizLogger logger = BIZ_LOGGER_CONCURRENT_HASH_MAP . get ( key ) ; if ( logger == null ) { synchronized ( BIZ_LOGGER_CONCURRENT_HASH_MAP ) { logger = BIZ_LOGGER_CONCURRENT_HASH_MAP . get ( key ) ; if ( logger != null ) { return logger ; } logger = new BizLoggerImpl ( level , remotingClient , appContext ) ; BIZ_LOGGER_CONCURRENT_HASH_MAP . put ( key , logger ) ; } } return logger ;
public class JpaRepository { /** * Returns all the entities contained in the repository paginated . * The query used for this operation is the one received by the constructor . * @ return all the entities contained in the repository paginated */ @ SuppressWarnings ( "unchecked" ) @ Override public final Collection < V > getAll ( final PaginationData pagination ) { } }
final Query builtQuery ; // Query created from the query data checkNotNull ( pagination , "Received a null pointer as the pagination data" ) ; // Builds the query builtQuery = getEntityManager ( ) . createQuery ( getAllValuesQuery ( ) ) ; // Sets the pagination applyPagination ( builtQuery , pagination ) ; // Processes the query return builtQuery . getResultList ( ) ;
public class VirtualNetworkGatewaysInner { /** * Updates a virtual network gateway tags . * @ param resourceGroupName The name of the resource group . * @ param virtualNetworkGatewayName The name of the virtual network gateway . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ throws CloudException thrown if the request is rejected by server * @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @ return the VirtualNetworkGatewayInner object if successful . */ public VirtualNetworkGatewayInner updateTags ( String resourceGroupName , String virtualNetworkGatewayName ) { } }
return updateTagsWithServiceResponseAsync ( resourceGroupName , virtualNetworkGatewayName ) . toBlocking ( ) . last ( ) . body ( ) ;
public class TCPChannel { /** * Initialize this channel . * @ param runtimeConfig * @ param tcpConfig * @ throws ChannelException */ public void setup ( ChannelData runtimeConfig , TCPChannelConfiguration tcpConfig ) throws ChannelException { } }
setup ( runtimeConfig , tcpConfig , null ) ;
public class CmsRole { /** * Returns a role violation exception configured with a localized , role specific message * for this role . < p > * @ param requestContext the current users OpenCms request context * @ return a role violation exception configured with a localized , role specific message * for this role */ public CmsRoleViolationException createRoleViolationException ( CmsRequestContext requestContext ) { } }
return new CmsRoleViolationException ( Messages . get ( ) . container ( Messages . ERR_USER_NOT_IN_ROLE_2 , requestContext . getCurrentUser ( ) . getName ( ) , getName ( requestContext . getLocale ( ) ) ) ) ;
public class ApolloCodegenInstallTask { /** * Generates a dummy package . json file to silence npm warnings */ private void writePackageFile ( File apolloPackageFile ) { } }
try { JsonWriter writer = JsonWriter . of ( Okio . buffer ( Okio . sink ( apolloPackageFile ) ) ) ; writer . beginObject ( ) ; writer . name ( "name" ) . value ( "apollo-android" ) ; writer . name ( "version" ) . value ( "0.0.1" ) ; writer . name ( "description" ) . value ( "Generates Java code based on a GraphQL schema and query documents. Uses " + "apollo-codegen under the hood." ) ; writer . name ( "name" ) . value ( "apollo-android" ) ; writer . name ( "repository" ) ; writer . beginObject ( ) ; writer . name ( "type" ) . value ( "git" ) ; writer . name ( "url" ) . value ( "git+https://github.com/apollostack/apollo-android.git" ) ; writer . endObject ( ) ; writer . name ( "author" ) . value ( "Apollo" ) ; writer . name ( "license" ) . value ( "MIT" ) ; writer . endObject ( ) ; writer . close ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; }
public class FindComponentsByClassVisitor { /** * { @ inheritDoc } */ @ Override public VisitorResult visit ( final WComponent comp ) { } }
// Check if root component should be included ( if ignore then just continue ) if ( ! includeRoot && comp == root ) { return VisitorResult . CONTINUE ; } boolean match = false ; // Check inherited classes outer : for ( Class < ? > clazz = comp . getClass ( ) ; clazz != null ; clazz = clazz . getSuperclass ( ) ) { // Check if inherited class name is a match if ( classNamesMatch ( clazz . getName ( ) , className ) ) { match = true ; break ; } // Check interfaces for ( Class intClazz : clazz . getInterfaces ( ) ) { if ( classNamesMatch ( intClazz . getName ( ) , className ) ) { match = true ; break outer ; } } } if ( match ) { boolean cont = handleFoundMatch ( new ComponentWithContext ( comp , UIContextHolder . getCurrent ( ) ) ) ; return cont ? VisitorResult . CONTINUE : VisitorResult . ABORT ; } return VisitorResult . CONTINUE ;
public class HttpUtils { /** * Do a GET request on the provided URL and construct the Query String part * with the provided list of parameters . If the URL already contains * parameters ( already contains a ' ? ' character ) , then the parameters are * added to the existing parameters . The parameters are converted into * < code > application / x - www - form - urlencoded < / code > . For example : * < code > field1 = value1 & amp ; field1 = value2 & amp ; field2 = value3 < / code > . The special * characters are encoded . If there is a space , it is encoded into ' % 20 ' . * The parameters can be anything : * < ul > * < li > { @ link Parameter } : see { @ link # get ( String , Parameter . . . ) } < / li > * < li > { @ link Map } : each entry is used as a parameter ( see * { @ link # get ( String , Map ) } ) . The key of the entry is the name of the * parameter , the value of the entry is the value of the parameter < / li > * < li > A bean ( any object ) : each property of the bean is used as parameter * ( see { @ link BeanUtils } ) . The name of the property is the name of the * parameter , the value of the property is the value of the parameter < / li > * < / ul > * @ param url * the base url * @ param params * none , one or several parameters to append to the query string * @ return the response * @ throws HttpException * when the request has failed */ @ SuppressWarnings ( "unchecked" ) public static Response get ( String url , Object ... params ) throws HttpException { } }
try { Map < String , Object > map = new HashMap < > ( ) ; for ( Object bean : params ) { if ( bean instanceof Parameter ) { Parameter p = ( Parameter ) bean ; map . put ( p . getName ( ) , p . getValue ( ) ) ; } else if ( bean instanceof Map ) { map . putAll ( ( Map < String , Object > ) bean ) ; } else { map . putAll ( BeanUtils . convert ( bean ) ) ; } } return get ( url , map ) ; } catch ( BeanException e ) { throw new HttpException ( "Failed to convert bean fields into request parameters" , e ) ; }
public class SqlMapper { /** * 删除数据 * @ param sql 执行的sql * @ param value 参数 * @ return 执行行数 */ public int delete ( String sql , Object value ) { } }
Class < ? > parameterType = value != null ? value . getClass ( ) : null ; String msId = msUtils . deleteDynamic ( sql , parameterType ) ; return sqlSession . delete ( msId , value ) ;
public class TvdbParser { /** * Parse the banner record from the document * @ param eBanner * @ throws Throwable */ private static Banner parseNextBanner ( Element eBanner ) { } }
Banner banner = new Banner ( ) ; String artwork ; artwork = DOMHelper . getValueFromElement ( eBanner , BANNER_PATH ) ; if ( ! artwork . isEmpty ( ) ) { banner . setUrl ( URL_BANNER + artwork ) ; } artwork = DOMHelper . getValueFromElement ( eBanner , VIGNETTE_PATH ) ; if ( ! artwork . isEmpty ( ) ) { banner . setVignette ( URL_BANNER + artwork ) ; } artwork = DOMHelper . getValueFromElement ( eBanner , THUMBNAIL_PATH ) ; if ( ! artwork . isEmpty ( ) ) { banner . setThumb ( URL_BANNER + artwork ) ; } banner . setId ( DOMHelper . getValueFromElement ( eBanner , "id" ) ) ; banner . setBannerType ( BannerListType . fromString ( DOMHelper . getValueFromElement ( eBanner , "BannerType" ) ) ) ; banner . setBannerType2 ( BannerType . fromString ( DOMHelper . getValueFromElement ( eBanner , "BannerType2" ) ) ) ; banner . setLanguage ( DOMHelper . getValueFromElement ( eBanner , LANGUAGE ) ) ; banner . setSeason ( DOMHelper . getValueFromElement ( eBanner , "Season" ) ) ; banner . setColours ( DOMHelper . getValueFromElement ( eBanner , "Colors" ) ) ; banner . setRating ( DOMHelper . getValueFromElement ( eBanner , RATING ) ) ; banner . setRatingCount ( DOMHelper . getValueFromElement ( eBanner , "RatingCount" ) ) ; try { banner . setSeriesName ( Boolean . parseBoolean ( DOMHelper . getValueFromElement ( eBanner , SERIES_NAME ) ) ) ; } catch ( WebServiceException ex ) { LOG . trace ( "Failed to transform SeriesName to boolean" , ex ) ; banner . setSeriesName ( false ) ; } return banner ;
public class TypeConformanceComputer { /** * Logic was moved to inner class CommonSuperTypeFinder in the context of bug 495314. * This method is scheduled for deletion in Xtext 2.15 * @ deprecated see { @ link CommonSuperTypeFinder # enhanceSuperType ( List , ParameterizedTypeReference ) } */ @ Deprecated protected final boolean enhanceSuperType ( List < LightweightTypeReference > superTypes , List < LightweightTypeReference > initiallyRequested , ParameterizedTypeReference result ) { } }
CommonSuperTypeFinder typeFinder = newCommonSuperTypeFinder ( superTypes . get ( 0 ) . getOwner ( ) ) ; typeFinder . requestsInProgress = Lists . newArrayList ( ) ; typeFinder . requestsInProgress . add ( initiallyRequested ) ; return typeFinder . enhanceSuperType ( superTypes , result ) ;
public class SARLProjectConfigurator { /** * Collect the list of SARL project folders that are under directory into files . * @ param folders the list of folders to fill in . * @ param directory the directory to explore . * @ param directoriesVisited Set of canonical paths of directories , used as recursion guard . * @ param nestedProjects whether to look for nested projects . * @ param monitor The monitor to report to . */ @ SuppressWarnings ( "checkstyle:npathcomplexity" ) protected void collectProjectFoldersFromDirectory ( Collection < File > folders , File directory , Set < String > directoriesVisited , boolean nestedProjects , IProgressMonitor monitor ) { } }
if ( monitor . isCanceled ( ) ) { return ; } monitor . subTask ( NLS . bind ( Messages . SARLProjectConfigurator_0 , directory . getPath ( ) ) ) ; final File [ ] contents = directory . listFiles ( ) ; if ( contents == null ) { return ; } Set < String > visited = directoriesVisited ; if ( visited == null ) { visited = new HashSet < > ( ) ; try { visited . add ( directory . getCanonicalPath ( ) ) ; } catch ( IOException exception ) { StatusManager . getManager ( ) . handle ( StatusUtil . newStatus ( IStatus . ERROR , exception . getLocalizedMessage ( ) , exception ) ) ; } } final Set < File > subdirectories = new LinkedHashSet < > ( ) ; for ( final File file : contents ) { if ( file . isDirectory ( ) ) { subdirectories . add ( file ) ; } else if ( file . getName ( ) . endsWith ( this . fileExtension ) ) { // Found a SARL file . final File rootFile = getProjectFolderForSourceFolder ( file . getParentFile ( ) ) ; if ( rootFile != null ) { folders . add ( rootFile ) ; return ; } } } for ( final File subdir : subdirectories ) { try { final String canonicalPath = subdir . getCanonicalPath ( ) ; if ( ! visited . add ( canonicalPath ) ) { // already been here - - > do not recurse continue ; } } catch ( IOException exception ) { StatusManager . getManager ( ) . handle ( StatusUtil . newStatus ( IStatus . ERROR , exception . getLocalizedMessage ( ) , exception ) ) ; } collectProjectFoldersFromDirectory ( folders , subdir , visited , nestedProjects , monitor ) ; }
public class RedisObjectFactory { /** * New redis template . * @ param < K > the type parameter * @ param < V > the type parameter * @ param connectionFactory the connection factory * @ return the redis template */ public static < K , V > RedisTemplate < K , V > newRedisTemplate ( final RedisConnectionFactory connectionFactory ) { } }
val template = new RedisTemplate < K , V > ( ) ; val string = new StringRedisSerializer ( ) ; val jdk = new JdkSerializationRedisSerializer ( ) ; template . setKeySerializer ( string ) ; template . setValueSerializer ( jdk ) ; template . setHashValueSerializer ( jdk ) ; template . setHashKeySerializer ( string ) ; template . setConnectionFactory ( connectionFactory ) ; return template ;
public class BaasObject { /** * Asynchronously revokes the access < code > grant < / code > to this object from users with < code > role < / code > . * The outcome of the request is handed to the provided < code > handler < / code > . * @ param grant a non null { @ link com . baasbox . android . Grant } * @ param role a non null username * @ param handler an handler that will receive the outcome of the request . * @ return a { @ link com . baasbox . android . RequestToken } to manage the asynchronous request */ public final RequestToken revokeAll ( Grant grant , String role , BaasHandler < Void > handler ) { } }
return grantAll ( grant , role , RequestOptions . DEFAULT , handler ) ;
public class Studio { /** * Returns table with column renderers . */ private JTable withColRenderers ( final JTable table ) { } }
// Data renderers final DefaultTableCellRenderer dtcr = new DefaultTableCellRenderer ( ) ; // BigDecimal table . setDefaultRenderer ( BigDecimal . class , new TableCellRenderer ( ) { public Component getTableCellRendererComponent ( final JTable table , final Object value , final boolean isSelected , final boolean hasFocus , final int row , final int column ) { final BigDecimal bd = ( BigDecimal ) value ; return dtcr . getTableCellRendererComponent ( table , bd . toString ( ) , isSelected , hasFocus , row , column ) ; } } ) ; // Boolean table . setDefaultRenderer ( Boolean . class , new TableCellRenderer ( ) { public Component getTableCellRendererComponent ( final JTable table , final Object value , final boolean isSelected , final boolean hasFocus , final int row , final int column ) { final Boolean b = ( Boolean ) value ; return dtcr . getTableCellRendererComponent ( table , Boolean . toString ( b ) , isSelected , hasFocus , row , column ) ; } } ) ; // Date table . setDefaultRenderer ( java . sql . Date . class , new TableCellRenderer ( ) { public Component getTableCellRendererComponent ( final JTable table , final Object value , final boolean isSelected , final boolean hasFocus , final int row , final int column ) { final java . sql . Date d = ( java . sql . Date ) value ; return dtcr . getTableCellRendererComponent ( table , String . format ( "%tF" , d ) , isSelected , hasFocus , row , column ) ; } } ) ; // Time table . setDefaultRenderer ( Time . class , new TableCellRenderer ( ) { public Component getTableCellRendererComponent ( final JTable table , final Object value , final boolean isSelected , final boolean hasFocus , final int row , final int column ) { final Time t = ( Time ) value ; return dtcr . getTableCellRendererComponent ( table , String . format ( "%tr" , t ) , isSelected , hasFocus , row , column ) ; } } ) ; // Timestamp table . setDefaultRenderer ( Timestamp . class , new TableCellRenderer ( ) { public Component getTableCellRendererComponent ( final JTable table , final Object value , final boolean isSelected , final boolean hasFocus , final int row , final int column ) { final Time t = ( Time ) value ; return dtcr . getTableCellRendererComponent ( table , String . format ( "%tr" , t ) , isSelected , hasFocus , row , column ) ; } } ) ; return table ;
public class ApptentiveNotificationObserverList { /** * Removes observer os its weak reference from the list * @ return < code > true < / code > if observer was returned */ boolean removeObserver ( ApptentiveNotificationObserver observer ) { } }
int index = indexOf ( observer ) ; if ( index != - 1 ) { observers . remove ( index ) ; return true ; } return false ;
public class CommerceOrderNoteUtil { /** * Returns the commerce order notes before and after the current commerce order note in the ordered set where commerceOrderId = & # 63 ; . * @ param commerceOrderNoteId the primary key of the current commerce order note * @ param commerceOrderId the commerce order ID * @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > ) * @ return the previous , current , and next commerce order note * @ throws NoSuchOrderNoteException if a commerce order note with the primary key could not be found */ public static CommerceOrderNote [ ] findByCommerceOrderId_PrevAndNext ( long commerceOrderNoteId , long commerceOrderId , OrderByComparator < CommerceOrderNote > orderByComparator ) throws com . liferay . commerce . exception . NoSuchOrderNoteException { } }
return getPersistence ( ) . findByCommerceOrderId_PrevAndNext ( commerceOrderNoteId , commerceOrderId , orderByComparator ) ;
public class CSSBoxTree { /** * Creates the style declaration for a text box based on the given { @ link BoxStyle } structure . * @ param style The source box style . * @ return The element style definition . */ protected NodeData createTextStyle ( BoxStyle style , float width ) { } }
NodeData ret = CSSFactory . createNodeData ( ) ; TermFactory tf = CSSFactory . getTermFactory ( ) ; ret . push ( createDeclaration ( "position" , tf . createIdent ( "absolute" ) ) ) ; ret . push ( createDeclaration ( "overflow" , tf . createIdent ( "hidden" ) ) ) ; ret . push ( createDeclaration ( "left" , tf . createLength ( style . getLeft ( ) , unit ) ) ) ; ret . push ( createDeclaration ( "top" , tf . createLength ( style . getTop ( ) , unit ) ) ) ; ret . push ( createDeclaration ( "line-height" , tf . createLength ( style . getLineHeight ( ) , unit ) ) ) ; if ( style . getFontFamily ( ) != null ) ret . push ( createDeclaration ( "font-family" , tf . createString ( style . getFontFamily ( ) ) ) ) ; if ( style . getFontSize ( ) != 0 ) { float size = ( float ) style . getFontSize ( ) ; if ( style . getFontFamily ( ) == null ) size = size * unknownFontScale ; ret . push ( createDeclaration ( "font-size" , tf . createLength ( size , unit ) ) ) ; } if ( style . getFontWeight ( ) != null ) ret . push ( createDeclaration ( "font-weight" , tf . createIdent ( style . getFontWeight ( ) ) ) ) ; if ( style . getFontStyle ( ) != null ) ret . push ( createDeclaration ( "font-style" , tf . createIdent ( style . getFontStyle ( ) ) ) ) ; if ( style . getWordSpacing ( ) != 0 ) ret . push ( createDeclaration ( "word-spacing" , tf . createLength ( ( float ) style . getWordSpacing ( ) , unit ) ) ) ; if ( style . getLetterSpacing ( ) != 0 ) ret . push ( createDeclaration ( "letter-spacing" , tf . createLength ( ( float ) style . getLetterSpacing ( ) , unit ) ) ) ; if ( style . getColor ( ) != null ) { String fillColor = style . getColor ( ) ; // text stroke css attrs don ' t render atm but can use stroke as fall back for fill if fill is transparent boolean hasStrokeColor = style . getStrokeColor ( ) != null && fillColor . equals ( transparentColor ) ; if ( fillColor . equals ( transparentColor ) && hasStrokeColor ) fillColor = style . getStrokeColor ( ) ; ret . push ( createDeclaration ( "color" , createTermColor ( fillColor ) ) ) ; } ret . push ( createDeclaration ( "width" , tf . createLength ( width , unit ) ) ) ; return ret ;
public class MediaType { /** * < em > Replaces < / em > all parameters with the given parameters . * @ throws IllegalArgumentException if any parameter or value is invalid */ public MediaType withParameters ( Map < String , ? extends Iterable < String > > parameters ) { } }
final ImmutableListMultimap . Builder < String , String > builder = ImmutableListMultimap . builder ( ) ; for ( Map . Entry < String , ? extends Iterable < String > > e : parameters . entrySet ( ) ) { final String k = e . getKey ( ) ; for ( String v : e . getValue ( ) ) { builder . put ( k , v ) ; } } return create ( type , subtype , builder . build ( ) ) ;
public class CPDefinitionOptionValueRelPersistenceImpl { /** * Removes the cp definition option value rel with the primary key from the database . Also notifies the appropriate model listeners . * @ param primaryKey the primary key of the cp definition option value rel * @ return the cp definition option value rel that was removed * @ throws NoSuchCPDefinitionOptionValueRelException if a cp definition option value rel with the primary key could not be found */ @ Override public CPDefinitionOptionValueRel remove ( Serializable primaryKey ) throws NoSuchCPDefinitionOptionValueRelException { } }
Session session = null ; try { session = openSession ( ) ; CPDefinitionOptionValueRel cpDefinitionOptionValueRel = ( CPDefinitionOptionValueRel ) session . get ( CPDefinitionOptionValueRelImpl . class , primaryKey ) ; if ( cpDefinitionOptionValueRel == null ) { if ( _log . isDebugEnabled ( ) ) { _log . debug ( _NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey ) ; } throw new NoSuchCPDefinitionOptionValueRelException ( _NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey ) ; } return remove ( cpDefinitionOptionValueRel ) ; } catch ( NoSuchCPDefinitionOptionValueRelException nsee ) { throw nsee ; } catch ( Exception e ) { throw processException ( e ) ; } finally { closeSession ( session ) ; }
public class FavoritesInner { /** * Gets a list of favorites defined within an Application Insights component . * @ param resourceGroupName The name of the resource group . * @ param resourceName The name of the Application Insights component resource . * @ 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 < List < ApplicationInsightsComponentFavoriteInner > > listAsync ( String resourceGroupName , String resourceName , final ServiceCallback < List < ApplicationInsightsComponentFavoriteInner > > serviceCallback ) { } }
return ServiceFuture . fromResponse ( listWithServiceResponseAsync ( resourceGroupName , resourceName ) , serviceCallback ) ;
public class BottomSheet { /** * Adds a new divider to the bottom sheet . * @ param titleId * The resource id of the title of the divider , which should be added , as an { @ link * Integer } value . The resource id must correspond to a valid string resource */ public final void addDivider ( @ StringRes final int titleId ) { } }
Divider divider = new Divider ( ) ; divider . setTitle ( getContext ( ) , titleId ) ; adapter . add ( divider ) ; adaptGridViewHeight ( ) ;
public class CSSHandler { /** * Create a { @ link CSSDeclarationList } object from a parsed object . * @ param eVersion * The CSS version to use . May not be < code > null < / code > . * @ param aNode * The parsed CSS object to read . May not be < code > null < / code > . * @ return Never < code > null < / code > . */ @ Nonnull @ Deprecated public static CSSDeclarationList readDeclarationListFromNode ( @ Nonnull final ECSSVersion eVersion , @ Nonnull final CSSNode aNode ) { } }
return readDeclarationListFromNode ( eVersion , aNode , CSSReader . getDefaultInterpretErrorHandler ( ) ) ;
public class DefaultOptionParser { /** * Handles the following tokens : * < pre > * - - L = V * - - L V * < / pre > * @ param token the command line token to handle * @ throws OptionParserException if option parsing fails */ private void handleLongOption ( String token ) throws OptionParserException { } }
if ( token . indexOf ( '=' ) == - 1 ) { handleLongOptionWithoutEqual ( token ) ; } else { handleLongOptionWithEqual ( token ) ; }
public class Repositories { /** * Loads repository description . */ private static void loadRepositoryDescription ( ) { } }
LOGGER . log ( Level . INFO , "Loading repository description...." ) ; final InputStream inputStream = AbstractRepository . class . getResourceAsStream ( "/repository.json" ) ; if ( null == inputStream ) { LOGGER . log ( Level . INFO , "Not found repository description [repository.json] file under classpath" ) ; return ; } LOGGER . log ( Level . INFO , "Parsing repository description...." ) ; try { final String description = IOUtils . toString ( inputStream , "UTF-8" ) ; LOGGER . log ( Level . DEBUG , "{0}{1}" , new Object [ ] { Strings . LINE_SEPARATOR , description } ) ; repositoriesDescription = new JSONObject ( description ) ; // Repository name prefix final String tableNamePrefix = StringUtils . isNotBlank ( Latkes . getLocalProperty ( "jdbc.tablePrefix" ) ) ? Latkes . getLocalProperty ( "jdbc.tablePrefix" ) + "_" : "" ; final JSONArray repositories = repositoriesDescription . optJSONArray ( "repositories" ) ; for ( int i = 0 ; i < repositories . length ( ) ; i ++ ) { final JSONObject repository = repositories . optJSONObject ( i ) ; repository . put ( "name" , tableNamePrefix + repository . optString ( "name" ) ) ; } } catch ( final Exception e ) { LOGGER . log ( Level . ERROR , "Parses repository description failed" , e ) ; } finally { try { inputStream . close ( ) ; } catch ( final IOException e ) { LOGGER . log ( Level . ERROR , e . getMessage ( ) , e ) ; throw new RuntimeException ( e ) ; } }
public class VdmBreakpointPropertyPage { /** * Adds the given error message to the errors currently displayed on this page . The page displays the most recently * added error message . Clients should retain messages that are passed into this method as the message should later * be passed into removeErrorMessage ( String ) to clear the error . This method should be used instead of * setErrorMessage ( String ) . * @ param message * the error message to display on this page . */ protected void addErrorMessage ( String message ) { } }
fErrorMessages . remove ( message ) ; fErrorMessages . add ( message ) ; setErrorMessage ( message ) ; setValid ( message == null ) ;
public class CommerceAddressPersistenceImpl { /** * Returns all the commerce addresses where commerceCountryId = & # 63 ; . * @ param commerceCountryId the commerce country ID * @ return the matching commerce addresses */ @ Override public List < CommerceAddress > findByCommerceCountryId ( long commerceCountryId ) { } }
return findByCommerceCountryId ( commerceCountryId , QueryUtil . ALL_POS , QueryUtil . ALL_POS , null ) ;
public class InMemoryTopology { /** * { @ inheritDoc } . * If the result is already in cache , return the result . * Otherwise , delegate the functionality to the fallback object */ @ Override public List < ConfigKeyPath > getOwnImports ( ConfigKeyPath configKey ) { } }
return getOwnImports ( configKey , Optional . < Config > absent ( ) ) ;
public class RollingLogger { /** * Get the log file index from the composed log file name . * @ param fileName * Log file name with index appended * @ return Log file index */ private int getLogFileIndex ( String fileName ) { } }
int fileIndex = 0 ; try { fileIndex = Integer . parseInt ( fileName . substring ( fileName . lastIndexOf ( COUNT_SEPARATOR ) + 1 ) ) ; } catch ( NumberFormatException e ) { e . printStackTrace ( ) ; } return fileIndex ;
public class NonBlockingStringReader { /** * Marks the present position in the stream . Subsequent calls to reset ( ) will * reposition the stream to this point . * @ param nReadAheadLimit * Limit on the number of characters that may be read while still * preserving the mark . Because the stream ' s input comes from a string , * there is no actual limit , so this argument must not be negative , but * is otherwise ignored . * @ exception IllegalArgumentException * If readAheadLimit is & lt ; 0 * @ exception IOException * If an I / O error occurs */ @ Override public void mark ( final int nReadAheadLimit ) throws IOException { } }
ValueEnforcer . isGE0 ( nReadAheadLimit , "ReadAheadLimit" ) ; _ensureOpen ( ) ; m_nMark = m_nNext ;
public class HeapKeyedStateBackend { /** * Returns the total number of state entries across all keys for the given namespace . */ @ VisibleForTesting public int numKeyValueStateEntries ( Object namespace ) { } }
int sum = 0 ; for ( StateTable < ? , ? , ? > state : registeredKVStates . values ( ) ) { sum += state . sizeOfNamespace ( namespace ) ; } return sum ;
public class RelatedTablesCoreExtension { /** * Adds an attributes relationship between the base table and related * attributes table . Creates a default user mapping table if needed . * @ param baseTableName * base table name * @ param relatedAttributesTableName * related attributes table name * @ param mappingTableName * mapping table name * @ return The relationship that was added * @ since 3.2.0 */ public ExtendedRelation addAttributesRelationship ( String baseTableName , String relatedAttributesTableName , String mappingTableName ) { } }
return addRelationship ( baseTableName , relatedAttributesTableName , mappingTableName , RelationType . ATTRIBUTES ) ;
public class MscRuntimeContainerDelegate { /** * ProcessApplicationService implementation / / / / / */ public ProcessApplicationInfo getProcessApplicationInfo ( String processApplicationName ) { } }
MscManagedProcessApplication managedPa = getManagedProcessApplication ( processApplicationName ) ; if ( managedPa == null ) { return null ; } else { return managedPa . getProcessApplicationInfo ( ) ; }
public class FrequencySketch { /** * Returns the estimated number of occurrences of an element , up to the maximum ( 15 ) . * @ param hash the hash code of the element to count occurrences of * @ return the estimated number of occurrences of the element ; possibly zero but never negative */ int frequency ( long hash ) { } }
long start = ( hash & 3 ) << 2 ; int frequency = countOf ( start , 0 , indexOf ( hash , 0 ) ) ; frequency = Math . min ( frequency , countOf ( start , 1 , indexOf ( hash , 1 ) ) ) ; frequency = Math . min ( frequency , countOf ( start , 2 , indexOf ( hash , 2 ) ) ) ; return Math . min ( frequency , countOf ( start , 3 , indexOf ( hash , 3 ) ) ) ;
public class AppServicePlansInner { /** * Create or update a Virtual Network route in an App Service plan . * Create or update a Virtual Network route in an App Service plan . * @ param resourceGroupName Name of the resource group to which the resource belongs . * @ param name Name of the App Service plan . * @ param vnetName Name of the Virtual Network . * @ param routeName Name of the Virtual Network route . * @ param route Definition of the Virtual Network route . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the VnetRouteInner object */ public Observable < VnetRouteInner > updateVnetRouteAsync ( String resourceGroupName , String name , String vnetName , String routeName , VnetRouteInner route ) { } }
return updateVnetRouteWithServiceResponseAsync ( resourceGroupName , name , vnetName , routeName , route ) . map ( new Func1 < ServiceResponse < VnetRouteInner > , VnetRouteInner > ( ) { @ Override public VnetRouteInner call ( ServiceResponse < VnetRouteInner > response ) { return response . body ( ) ; } } ) ;
public class Bar { /** * Set a gradient color from point 1 with color 1 to point2 with color 2. * @ param x1 The first horizontal location . * @ param y1 The first vertical location . * @ param color1 The first color . * @ param x2 The last horizontal location . * @ param y2 The last vertical location . * @ param color2 The last color . */ public void setColorGradient ( int x1 , int y1 , ColorRgba color1 , int x2 , int y2 , ColorRgba color2 ) { } }
gradientColor = new ColorGradient ( x1 , y1 , color1 , x2 , y2 , color2 ) ;
public class Xml { /** * Find elements through an XPath like pathQuery * e . g . * / fruits / orange * will find the orange element : * < fruits > < orange / > < / fruits > * @ param pathQuery path pathQuery string * @ return { @ code List } of { @ code Node } objects matching the query * @ throws XmlModelException XML model exception */ public List < Node > pathQuery ( String pathQuery ) throws XmlModelException { } }
return new PathQueryParser ( root ) . pathQuery ( pathQuery ) ;
public class DescribeInstanceAttributeRequest { /** * This method is intended for internal use only . Returns the marshaled request configured with additional * parameters to enable operation dry - run . */ @ Override public Request < DescribeInstanceAttributeRequest > getDryRunRequest ( ) { } }
Request < DescribeInstanceAttributeRequest > request = new DescribeInstanceAttributeRequestMarshaller ( ) . marshall ( this ) ; request . addParameter ( "DryRun" , Boolean . toString ( true ) ) ; return request ;
public class SystemClassReflectionGenerator { /** * TODO remove extraneous visits to things like lvar names */ public static void generateJLCGDMS ( ClassWriter cw , String classname , String field , String methodname ) { } }
FieldVisitor fv = cw . visitField ( ACC_PUBLIC + ACC_STATIC , field , "Ljava/lang/reflect/Method;" , null , null ) ; fv . visitEnd ( ) ; MethodVisitor mv = cw . visitMethod ( ACC_PRIVATE + ACC_STATIC , field , "(Ljava/lang/Class;)[Ljava/lang/reflect/Method;" , null , null ) ; mv . visitCode ( ) ; Label l0 = new Label ( ) ; Label l1 = new Label ( ) ; Label l2 = new Label ( ) ; mv . visitTryCatchBlock ( l0 , l1 , l2 , "java/lang/Exception" ) ; Label l3 = new Label ( ) ; mv . visitLabel ( l3 ) ; mv . visitFieldInsn ( GETSTATIC , classname , field , "Ljava/lang/reflect/Method;" ) ; mv . visitJumpInsn ( IFNONNULL , l0 ) ; Label l4 = new Label ( ) ; mv . visitLabel ( l4 ) ; mv . visitVarInsn ( ALOAD , 0 ) ; mv . visitMethodInsn ( INVOKEVIRTUAL , "java/lang/Class" , methodname , "()[Ljava/lang/reflect/Method;" , false ) ; mv . visitInsn ( ARETURN ) ; mv . visitLabel ( l0 ) ; mv . visitFieldInsn ( GETSTATIC , classname , field , "Ljava/lang/reflect/Method;" ) ; mv . visitInsn ( ACONST_NULL ) ; mv . visitInsn ( ICONST_1 ) ; mv . visitTypeInsn ( ANEWARRAY , "java/lang/Object" ) ; mv . visitInsn ( DUP ) ; mv . visitInsn ( ICONST_0 ) ; mv . visitVarInsn ( ALOAD , 0 ) ; mv . visitInsn ( AASTORE ) ; mv . visitMethodInsn ( INVOKEVIRTUAL , "java/lang/reflect/Method" , "invoke" , "(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;" , false ) ; mv . visitTypeInsn ( CHECKCAST , "[Ljava/lang/reflect/Method;" ) ; mv . visitLabel ( l1 ) ; mv . visitInsn ( ARETURN ) ; mv . visitLabel ( l2 ) ; mv . visitVarInsn ( ASTORE , 1 ) ; Label l5 = new Label ( ) ; mv . visitLabel ( l5 ) ; mv . visitInsn ( ACONST_NULL ) ; mv . visitInsn ( ARETURN ) ; Label l6 = new Label ( ) ; mv . visitLabel ( l6 ) ; // mv . visitLocalVariable ( " clazz " , " Ljava / lang / Class ; " , " Ljava / lang / Class < * > ; " , l3 , l6 , 0 ) ; // mv . visitLocalVariable ( " e " , " Ljava / lang / Exception ; " , null , l5 , l6 , 1 ) ; mv . visitMaxs ( 6 , 2 ) ; mv . visitEnd ( ) ;
public class ExpressRouteCrossConnectionsInner { /** * Gets the currently advertised ARP table associated with the express route cross connection in a resource group . * @ param resourceGroupName The name of the resource group . * @ param crossConnectionName The name of the ExpressRouteCrossConnection . * @ param peeringName The name of the peering . * @ param devicePath The path of the device * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable for the request */ public Observable < ServiceResponse < ExpressRouteCircuitsArpTableListResultInner > > listArpTableWithServiceResponseAsync ( String resourceGroupName , String crossConnectionName , String peeringName , String devicePath ) { } }
if ( resourceGroupName == null ) { throw new IllegalArgumentException ( "Parameter resourceGroupName is required and cannot be null." ) ; } if ( crossConnectionName == null ) { throw new IllegalArgumentException ( "Parameter crossConnectionName is required and cannot be null." ) ; } if ( peeringName == null ) { throw new IllegalArgumentException ( "Parameter peeringName is required and cannot be null." ) ; } if ( devicePath == null ) { throw new IllegalArgumentException ( "Parameter devicePath is required and cannot be null." ) ; } if ( this . client . subscriptionId ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.subscriptionId() is required and cannot be null." ) ; } final String apiVersion = "2018-08-01" ; Observable < Response < ResponseBody > > observable = service . listArpTable ( resourceGroupName , crossConnectionName , peeringName , devicePath , this . client . subscriptionId ( ) , apiVersion , this . client . acceptLanguage ( ) , this . client . userAgent ( ) ) ; return client . getAzureClient ( ) . getPostOrDeleteResultAsync ( observable , new TypeToken < ExpressRouteCircuitsArpTableListResultInner > ( ) { } . getType ( ) ) ;
public class ICUService { /** * Return a snapshot of the currently registered factories . There * is no guarantee that the list will still match the current * factory list of the service subsequent to this call . */ public final List < Factory > factories ( ) { } }
try { factoryLock . acquireRead ( ) ; return new ArrayList < Factory > ( factories ) ; } finally { factoryLock . releaseRead ( ) ; }
public class RingBuffer { /** * Write buffers content from mark ( included ) * @ param op * @ param splitter * @ return * @ throws IOException */ protected int writeTo ( SparseBufferOperator < B > op , Splitter < SparseBufferOperator < B > > splitter ) throws IOException { } }
return writeTo ( op , splitter , mark , marked ) ;
public class CPRulePersistenceImpl { /** * Returns all the cp rules . * @ return the cp rules */ @ Override public List < CPRule > findAll ( ) { } }
return findAll ( QueryUtil . ALL_POS , QueryUtil . ALL_POS , null ) ;
public class ParamListFactory { public < T > Param < List < T > > asAny ( ParamReader < List < T > > reader , String name ) { } }
return getParam ( reader , name ) ;
public class OrderAwarePluginRegistry { /** * Creates a new { @ link OrderAwarePluginRegistry } with the given { @ link Plugin } s and the order of the { @ link Plugin } s * reverted . * @ param plugins must not be { @ literal null } . * @ return * @ since 2.0 */ public static < S , T extends Plugin < S > > OrderAwarePluginRegistry < T , S > ofReverse ( List < ? extends T > plugins ) { } }
return of ( plugins , DEFAULT_REVERSE_COMPARATOR ) ;
public class BaseGridScreen { /** * Process the " Delete " toolbar command . * @ return true If command was handled */ public boolean onDelete ( ) { } }
if ( this . getEditing ( ) == false ) { // Can ' t delete on a disabled grid . String strError = "Can't Delete from disabled grid" ; if ( this . getTask ( ) != null ) if ( this . getTask ( ) . getApplication ( ) != null ) strError = ( ( BaseApplication ) this . getTask ( ) . getApplication ( ) ) . getResources ( ResourceConstants . ERROR_RESOURCE , true ) . getString ( strError ) ; this . displayError ( strError ) ; return false ; } return super . onDelete ( ) ;
public class ModelUtils { /** * Wrap object to a corresponding { @ link IModel } * @ param o object to wrap * @ param < K > type of a model to wrap * @ return { @ link IModel } which contains passed object o */ @ SuppressWarnings ( "unchecked" ) public static < K > IModel < K > model ( K o ) { } }
if ( o instanceof ODocument ) return ( IModel < K > ) new ODocumentModel ( ( ODocument ) o ) ; else if ( o instanceof ODocumentWrapper ) return ( IModel < K > ) new ODocumentWrapperModel < ODocumentWrapper > ( ( ODocumentWrapper ) o ) ; else if ( o instanceof Serializable ) return ( IModel < K > ) Model . of ( ( Serializable ) o ) ; else throw new WicketRuntimeException ( ModelUtils . class . getSimpleName ( ) + " can't work with non serializable objects: " + o ) ;
public class JCusparse { /** * < pre > * Description : Solution of triangular linear system op ( A ) * X = alpha * F , * with multiple right - hand - sides , where A is a sparse matrix in CSR storage * format , rhs F and solution X are dense tall matrices . * This routine implements algorithm 1 for this problem . * < / pre > */ public static int cusparseScsrsm_analysis ( cusparseHandle handle , int transA , int m , int nnz , cusparseMatDescr descrA , Pointer csrSortedValA , Pointer csrSortedRowPtrA , Pointer csrSortedColIndA , cusparseSolveAnalysisInfo info ) { } }
return checkResult ( cusparseScsrsm_analysisNative ( handle , transA , m , nnz , descrA , csrSortedValA , csrSortedRowPtrA , csrSortedColIndA , info ) ) ;
public class NativeRSAEngine { /** * initialise the RSA engine . * @ param forEncryption true if we are encrypting , false otherwise . * @ param param the necessary RSA key parameters . */ public void init ( boolean forEncryption , CipherParameters param ) { } }
if ( core == null ) { core = new NativeRSACoreEngine ( ) ; } core . init ( forEncryption , param ) ;
public class ModelHelper { /** * The method translates the internal object StreamConfiguration into REST response object . * @ param scope the scope of the stream * @ param streamName the name of the stream * @ param streamConfiguration The configuration of stream * @ return Stream properties wrapped in StreamResponse object */ public static final StreamProperty encodeStreamResponse ( String scope , String streamName , final StreamConfiguration streamConfiguration ) { } }
ScalingConfig scalingPolicy = new ScalingConfig ( ) ; if ( streamConfiguration . getScalingPolicy ( ) . getScaleType ( ) == ScalingPolicy . ScaleType . FIXED_NUM_SEGMENTS ) { scalingPolicy . setType ( ScalingConfig . TypeEnum . valueOf ( streamConfiguration . getScalingPolicy ( ) . getScaleType ( ) . name ( ) ) ) ; scalingPolicy . setMinSegments ( streamConfiguration . getScalingPolicy ( ) . getMinNumSegments ( ) ) ; } else { scalingPolicy . setType ( ScalingConfig . TypeEnum . valueOf ( streamConfiguration . getScalingPolicy ( ) . getScaleType ( ) . name ( ) ) ) ; scalingPolicy . setTargetRate ( streamConfiguration . getScalingPolicy ( ) . getTargetRate ( ) ) ; scalingPolicy . setScaleFactor ( streamConfiguration . getScalingPolicy ( ) . getScaleFactor ( ) ) ; scalingPolicy . setMinSegments ( streamConfiguration . getScalingPolicy ( ) . getMinNumSegments ( ) ) ; } RetentionConfig retentionConfig = null ; if ( streamConfiguration . getRetentionPolicy ( ) != null ) { retentionConfig = new RetentionConfig ( ) ; switch ( streamConfiguration . getRetentionPolicy ( ) . getRetentionType ( ) ) { case SIZE : retentionConfig . setType ( RetentionConfig . TypeEnum . LIMITED_SIZE_MB ) ; retentionConfig . setValue ( streamConfiguration . getRetentionPolicy ( ) . getRetentionParam ( ) / ( 1024 * 1024 ) ) ; break ; case TIME : retentionConfig . setType ( RetentionConfig . TypeEnum . LIMITED_DAYS ) ; retentionConfig . setValue ( Duration . ofMillis ( streamConfiguration . getRetentionPolicy ( ) . getRetentionParam ( ) ) . toDays ( ) ) ; break ; } } StreamProperty streamProperty = new StreamProperty ( ) ; streamProperty . setScopeName ( scope ) ; streamProperty . setStreamName ( streamName ) ; streamProperty . setScalingPolicy ( scalingPolicy ) ; streamProperty . setRetentionPolicy ( retentionConfig ) ; return streamProperty ;
public class FormInputHandler { /** * Creates a new { @ link FormInputHandler } based on this { @ link FormInputHandler } using the specified data key for retrieving * the value from the { @ link DataSet } associated with this { @ link FormInputHandler } . * @ param theDataKey * the data set key used to retrieve the value from the specified data set * @ return the new { @ link FormInputHandler } instance */ public FormInputHandler dataKey ( final String theDataKey ) { } }
checkState ( dataSet != null , "Cannot specify a data key. Please specify a DataSet first." ) ; Fields fields = new Fields ( this ) ; fields . dataKey = theDataKey ; return new FormInputHandler ( fields ) ;
public class UnderReplicatedBlocks { /** * Empty the queues . */ void clear ( ) { } }
for ( int i = 0 ; i < LEVEL ; i ++ ) { priorityQueues . get ( i ) . clear ( ) ; } raidQueue . clear ( ) ;
public class TypeVariableSignature { /** * / * ( non - Javadoc ) * @ see io . github . classgraph . TypeSignature # equalsIgnoringTypeParams ( io . github . classgraph . TypeSignature ) */ @ Override public boolean equalsIgnoringTypeParams ( final TypeSignature other ) { } }
if ( other instanceof ClassRefTypeSignature ) { if ( ( ( ClassRefTypeSignature ) other ) . className . equals ( "java.lang.Object" ) ) { // java . lang . Object can be reconciled with any type , so it can be reconciled with // any type variable return true ; } // Resolve the type variable against the containing class ' type parameters TypeParameter typeParameter ; try { typeParameter = resolve ( ) ; } catch ( final IllegalArgumentException e ) { // If the corresponding type parameter cannot be resolved : // unknown type variables can always be reconciled with a concrete class return true ; } if ( typeParameter . classBound == null && ( typeParameter . interfaceBounds == null || typeParameter . interfaceBounds . isEmpty ( ) ) ) { // If the type parameter has no bounds , just assume the type variable can be reconciled // to the class by type inference return true ; } if ( typeParameter . classBound != null ) { if ( typeParameter . classBound instanceof ClassRefTypeSignature ) { if ( typeParameter . classBound . equals ( other ) ) { // T extends X , and X = = other return true ; } } else if ( typeParameter . classBound instanceof TypeVariableSignature ) { // " X " is reconcilable with " Y extends X " return this . equalsIgnoringTypeParams ( typeParameter . classBound ) ; } else /* if ( typeParameter . classBound instanceof ArrayTypeSignature ) */ { return false ; } } if ( typeParameter . interfaceBounds != null ) { for ( final ReferenceTypeSignature interfaceBound : typeParameter . interfaceBounds ) { if ( interfaceBound instanceof ClassRefTypeSignature ) { if ( interfaceBound . equals ( other ) ) { // T implements X , and X = = other return true ; } } else if ( interfaceBound instanceof TypeVariableSignature ) { // " X " is reconcilable with " Y implements X " return this . equalsIgnoringTypeParams ( interfaceBound ) ; } else /* if ( interfaceBound instanceof ArrayTypeSignature ) */ { return false ; } } } // Type variable has a concrete bound that is not reconcilable with ' other ' // ( we don ' t follow the class hierarchy to compare the bound against the class reference , // since the compiler should only use the bound during type erasure , not some other class // in the class hierarchy ) return false ; } // Technically I think type variables are never equal to each other , due to capturing , // but just compare the variable name for equality here ( this should never get // triggered in general , since we only compare type - erased signatures to // non - type - erased signatures currently ) . return this . equals ( other ) ;
public class EntityField { /** * 先创建field , 然后可以通过该方法获取property等属性 * @ param other */ public void copyFromPropertyDescriptor ( EntityField other ) { } }
this . setter = other . setter ; this . getter = other . getter ; this . javaType = other . javaType ; this . name = other . name ;
public class Routed { /** * When target is a class , this method calls " newInstance " on the class . * Otherwise it returns the target as is . * @ return null if target is null */ public static Object instanceFromTarget ( Object target ) throws InstantiationException , IllegalAccessException { } }
if ( target == null ) return null ; if ( target instanceof Class ) { // Create handler from class Class < ? > klass = ( Class < ? > ) target ; return klass . newInstance ( ) ; } else { return target ; }
public class DigestServerAuthenticationMethod { /** * Generate the challenge string . * @ return a generated nonce . */ public String generateNonce ( ) { } }
// Get the time of day and run MD5 over it . Date date = new Date ( ) ; long time = date . getTime ( ) ; Random rand = new Random ( ) ; long pad = rand . nextLong ( ) ; String nonceString = ( Long . valueOf ( time ) ) . toString ( ) + ( Long . valueOf ( pad ) ) . toString ( ) ; byte mdbytes [ ] = messageDigest . digest ( nonceString . getBytes ( ) ) ; // Convert the mdbytes array into a hex string . return toHexString ( mdbytes ) ;
public class GoogleCloudStorageReadChannel { /** * Closes this channel . * @ throws IOException on IO error */ @ Override public void close ( ) throws IOException { } }
if ( ! channelIsOpen ) { logger . atFine ( ) . log ( "Ignoring close: channel for '%s' is not open." , resourceIdString ) ; return ; } logger . atFine ( ) . log ( "Closing channel for '%s'" , resourceIdString ) ; channelIsOpen = false ; closeContentChannel ( ) ;
public class AbstractStrategy { /** * Print the item ranking and scores for a specific user . * @ param user The user ( as a String ) . * @ param scoredItems The item to print rankings for . * @ param out Where to direct the print . * @ param format The format of the printer . */ protected void printRanking ( final String user , final Map < Long , Double > scoredItems , final PrintStream out , final OUTPUT_FORMAT format ) { } }
final Map < Double , Set < Long > > preferenceMap = new HashMap < Double , Set < Long > > ( ) ; for ( Map . Entry < Long , Double > e : scoredItems . entrySet ( ) ) { long item = e . getKey ( ) ; double pref = e . getValue ( ) ; // ignore NaN ' s if ( Double . isNaN ( pref ) ) { continue ; } Set < Long > items = preferenceMap . get ( pref ) ; if ( items == null ) { items = new HashSet < Long > ( ) ; preferenceMap . put ( pref , items ) ; } items . add ( item ) ; } final List < Double > sortedScores = new ArrayList < Double > ( preferenceMap . keySet ( ) ) ; Collections . sort ( sortedScores , Collections . reverseOrder ( ) ) ; // Write estimated preferences int pos = 1 ; for ( double pref : sortedScores ) { for ( long itemID : preferenceMap . get ( pref ) ) { switch ( format ) { case TRECEVAL : out . println ( user + "\tQ0\t" + itemID + "\t" + pos + "\t" + pref + "\t" + "r" ) ; break ; default : case SIMPLE : out . println ( user + "\t" + itemID + "\t" + pref ) ; break ; } pos ++ ; } }
public class ServerStateMachineExecutor { /** * Commits the application of a command to the state machine . */ @ SuppressWarnings ( "unchecked" ) void commit ( ) { } }
// Execute any tasks that were queue during execution of the command . if ( ! tasks . isEmpty ( ) ) { for ( ServerTask task : tasks ) { context . update ( context . index ( ) , context . clock ( ) . instant ( ) , ServerStateMachineContext . Type . COMMAND ) ; try { task . future . complete ( task . callback . get ( ) ) ; } catch ( Exception e ) { task . future . completeExceptionally ( e ) ; } } tasks . clear ( ) ; } context . commit ( ) ;
public class Row { /** * Returns a sublist of the cells that belong to the specified family and qualifier . * @ see RowCell # compareByNative ( ) For details about the ordering . */ public List < RowCell > getCells ( @ Nonnull String family , @ Nonnull ByteString qualifier ) { } }
Preconditions . checkNotNull ( family , "family" ) ; Preconditions . checkNotNull ( qualifier , "qualifier" ) ; int start = getFirst ( family , qualifier ) ; if ( start < 0 ) { return ImmutableList . of ( ) ; } int end = getLast ( family , qualifier , start ) ; return getCells ( ) . subList ( start , end + 1 ) ;
public class GitlabAPI { /** * Get a list of the namespaces of the authenticated user . * If the user is an administrator , a list of all namespaces in the GitLab instance is shown . * @ return A list of gitlab namespace */ public List < GitlabNamespace > getNamespaces ( ) { } }
String tailUrl = GitlabNamespace . URL + PARAM_MAX_ITEMS_PER_PAGE ; return retrieve ( ) . getAll ( tailUrl , GitlabNamespace [ ] . class ) ;
public class SecurityUtils { /** * It decodes / deobfuscates an encoded password with a human readable prefix . * @ param encodedPasswordWithPrefix * @ return a String containing the decoded password */ public static String decodePasswordWithPrefix ( final String encodedPasswordWithPrefix ) { } }
if ( encodedPasswordWithPrefix == null ) { return null ; } if ( hasPrefix ( encodedPasswordWithPrefix ) ) { return decodePassword ( encodedPasswordWithPrefix . substring ( PREFIX . length ( ) ) ) ; } else { return encodedPasswordWithPrefix ; }
public class LdapPersonAttributeDao { /** * Sets the LdapTemplate , and thus the ContextSource ( implicitly ) . * @ param ldapTemplate the LdapTemplate to query the LDAP server from . CANNOT be NULL . */ public synchronized void setLdapTemplate ( final LdapTemplate ldapTemplate ) { } }
Assert . notNull ( ldapTemplate , "ldapTemplate cannot be null" ) ; this . ldapTemplate = ldapTemplate ; this . contextSource = this . ldapTemplate . getContextSource ( ) ;
public class BranchFilterModule { /** * Read and cache filter . */ private FilterUtils getFilterUtils ( final Element ditavalRef ) { } }
if ( ditavalRef . getAttribute ( ATTRIBUTE_NAME_HREF ) . isEmpty ( ) ) { return null ; } final URI href = toURI ( ditavalRef . getAttribute ( ATTRIBUTE_NAME_HREF ) ) ; final URI tmp = currentFile . resolve ( href ) ; final FileInfo fi = job . getFileInfo ( tmp ) ; final URI ditaval = fi . src ; FilterUtils f = filterCache . get ( ditaval ) ; if ( f == null ) { ditaValReader . filterReset ( ) ; logger . info ( "Reading " + ditaval ) ; ditaValReader . read ( ditaval ) ; Map < FilterUtils . FilterKey , FilterUtils . Action > filterMap = ditaValReader . getFilterMap ( ) ; f = new FilterUtils ( filterMap , ditaValReader . getForegroundConflictColor ( ) , ditaValReader . getBackgroundConflictColor ( ) ) ; f . setLogger ( logger ) ; filterCache . put ( ditaval , f ) ; } return f ;
public class XMLConfigAdmin { /** * * updates the Memory Logger * @ param memoryLogger * @ throws SecurityException / public void updateMemoryLogger ( String memoryLogger ) throws * SecurityException { boolean * hasAccess = ConfigWebUtil . hasAccess ( config , SecurityManager . TYPE _ DEBUGGING ) ; if ( ! hasAccess ) throw * new SecurityException ( " no access to change debugging settings " ) ; * Element debugging = _ getRootElement ( " debugging " ) ; * if ( memoryLogger . trim ( ) . length ( ) > 0 ) debugging . setAttribute ( " memory - log " , memoryLogger ) ; } */ private Element _getRootElement ( String name ) { } }
Element el = XMLConfigWebFactory . getChildByName ( doc . getDocumentElement ( ) , name ) ; if ( el == null ) { el = doc . createElement ( name ) ; doc . getDocumentElement ( ) . appendChild ( el ) ; } return el ;
public class OptionEditor { /** * Format the Object as String of concatenated properties . */ public String getAsText ( ) { } }
Object value = getValue ( ) ; if ( value == null ) { return "" ; } String propertyName = null ; // used in error handling below try { StringBuffer label = new StringBuffer ( ) ; for ( int i = 0 ; i < properties . length ; i ++ ) { propertyName = properties [ i ] ; Class < ? > propertyType = PropertyUtils . getPropertyType ( value , propertyName ) ; Object propertyValue = PropertyUtils . getNestedProperty ( value , propertyName ) ; PropertyEditor editor = registry . findCustomEditor ( propertyType , registryPropertyNamePrefix + propertyName ) ; if ( editor == null ) { label . append ( propertyValue ) ; } else { editor . setValue ( propertyValue ) ; label . append ( editor . getAsText ( ) ) ; editor . setValue ( null ) ; } if ( i < ( properties . length - 1 ) ) { label . append ( separator ) ; } } return label . toString ( ) ; } catch ( Exception e ) { throw new IllegalArgumentException ( "Couldn't access " + propertyName + " of " + value . getClass ( ) . getName ( ) + " : " + e . getMessage ( ) , e ) ; }
public class LogFileHeader { /** * Return the date field stored in the target header * @ return long The date field . */ public long date ( ) { } }
if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "date" , this ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "date" , new Long ( _date ) ) ; return _date ;
public class Nfs3 { /** * Query the port and root file handle for NFS server . * @ throws IOException */ private void prepareRootFhAndNfsPort ( ) throws IOException { } }
if ( ! _prepareLock . tryLock ( ) ) { return ; } try { _port = getNfsPortFromServer ( ) ; _rpcWrapper . setPort ( _port ) ; _rootFileHandle = lookupRootHandle ( ) ; } finally { _prepareLock . unlock ( ) ; }
public class ExportBucket { /** * Computes the minimal row for a bucket */ private Bytes getMinimalRow ( ) { } }
return Bytes . builder ( bucketRow . length ( ) + 1 ) . append ( bucketRow ) . append ( ':' ) . toBytes ( ) ;
public class AntStyleParser { /** * FIXME : Refactor ! */ public Appender parse ( String pattern ) throws IllegalArgumentException { } }
List < Appender > appenders = new ArrayList < Appender > ( ) ; int prev = 0 ; int pos = 0 ; while ( ( pos = pattern . indexOf ( VAR_START , pos ) ) >= 0 ) { // Add text between beginning / end of last variable if ( pos > prev ) { appenders . add ( new TextAppender ( pattern . substring ( prev , pos ) ) ) ; } // Move to real variable name beginning pos += VAR_START_LEN ; // Next close bracket ( not necessarily the variable end bracket if // there is a default value with nested variables int endVariable = pattern . indexOf ( VAR_CLOSE , pos ) ; if ( endVariable < 0 ) { throw new IllegalArgumentException ( format ( "Syntax error in property value ''{0}'', missing close bracket ''{1}'' for variable beginning at col {2}: ''{3}''" , pattern , VAR_CLOSE , pos - VAR_START_LEN , pattern . substring ( pos - VAR_START_LEN ) ) ) ; } // Try to skip eventual internal variable here int nextVariable = pattern . indexOf ( VAR_START , pos ) ; // Just used to throw exception with more accurate message int lastEndVariable = endVariable ; boolean hasNested = false ; while ( nextVariable >= 0 && nextVariable < endVariable ) { hasNested = true ; endVariable = pattern . indexOf ( VAR_CLOSE , endVariable + VAR_CLOSE_LEN ) ; // Something is badly closed if ( endVariable < 0 ) { throw new IllegalArgumentException ( format ( "Syntax error in property value ''{0}'', missing close bracket ''{1}'' for variable beginning at col {2}: ''{3}''" , pattern , VAR_CLOSE , nextVariable , pattern . substring ( nextVariable , lastEndVariable ) ) ) ; } nextVariable = pattern . indexOf ( VAR_START , nextVariable + VAR_START_LEN ) ; lastEndVariable = endVariable ; } // The chunk to process final String rawKey = pattern . substring ( pos - VAR_START_LEN , endVariable + VAR_CLOSE_LEN ) ; // Key without variable start and end symbols final String key = pattern . substring ( pos , endVariable ) ; int pipeIndex = key . indexOf ( PIPE_SEPARATOR ) ; boolean hasKeyVariables = false ; boolean hasDefault = false ; boolean hasDefaultVariables = false ; // There is a pipe if ( pipeIndex >= 0 ) { // No nested property detected , simple default part if ( ! hasNested ) { hasDefault = true ; hasDefaultVariables = false ; } // There is a pipe and nested variable , // determine if pipe is for the current variable or a nested key // variable else { int nextStartKeyVariable = key . indexOf ( VAR_START ) ; hasKeyVariables = pipeIndex > nextStartKeyVariable ; if ( hasKeyVariables ) { // ff $ { fdf } | $ { f } int nextEndKeyVariable = key . indexOf ( VAR_CLOSE , nextStartKeyVariable + VAR_START_LEN ) ; pipeIndex = key . indexOf ( PIPE_SEPARATOR , nextEndKeyVariable + VAR_CLOSE_LEN ) ; while ( pipeIndex >= 0 && pipeIndex > nextStartKeyVariable ) { pipeIndex = key . indexOf ( PIPE_SEPARATOR , nextEndKeyVariable + VAR_CLOSE_LEN ) ; nextStartKeyVariable = key . indexOf ( VAR_START , nextStartKeyVariable + VAR_START_LEN ) ; // No more nested variable if ( nextStartKeyVariable < 0 ) { break ; } nextEndKeyVariable = key . indexOf ( VAR_CLOSE , nextEndKeyVariable + VAR_CLOSE_LEN ) ; if ( nextEndKeyVariable < 0 ) { throw new IllegalArgumentException ( format ( "Syntax error in property value ''{0}'', missing close bracket ''{1}'' for variable beginning at col {2}: ''{3}''" , pattern , VAR_CLOSE , nextStartKeyVariable , key . substring ( nextStartKeyVariable ) ) ) ; } } } // nested variables are only for key , current variable does // not have a default value if ( pipeIndex >= 0 ) { hasDefault = true ; hasDefaultVariables = key . indexOf ( VAR_START , pipeIndex ) >= 0 ; } } } // No pipe , there is key variables if nested elements have been // detected else { hasKeyVariables = hasNested ; } // Construct variable appenders String keyPart = null ; String defaultPart = null ; if ( hasDefault ) { keyPart = key . substring ( 0 , pipeIndex ) . trim ( ) ; defaultPart = key . substring ( pipeIndex + PIPE_SEPARATOR_LEN ) . trim ( ) ; } else { keyPart = key . trim ( ) ; } // Choose TextAppender when relevant to avoid unecessary parsing when it ' s clearly not needed appenders . add ( new KeyAppender ( this , rawKey , hasKeyVariables ? parse ( keyPart ) : new TextAppender ( keyPart ) , ! hasDefault ? null : ( hasDefaultVariables ? parse ( defaultPart ) : new TextAppender ( defaultPart ) ) ) ) ; prev = endVariable + VAR_CLOSE_LEN ; pos = prev ; } if ( prev < pattern . length ( ) ) { appenders . add ( new TextAppender ( pattern . substring ( prev ) ) ) ; } return appenders . size ( ) == 1 ? appenders . get ( 0 ) : new MixinAppender ( pattern , appenders ) ;
public class SecurityUtil { /** * Log shell environment variables associated with Java process . */ public static void logShellEnvironmentVariables ( ) { } }
Map < String , String > env = System . getenv ( ) ; Iterator < String > keys = env . keySet ( ) . iterator ( ) ; while ( keys . hasNext ( ) ) { String key = keys . next ( ) ; String value = env . get ( key ) ; logMessage ( "Env, " + key + "=" + value . trim ( ) ) ; }
public class WordCluster { /** * 一次性统计概率 , 节约时间 */ private void statisticProb ( ) { } }
System . out . println ( "统计概率" ) ; TIntFloatIterator it = wordProb . iterator ( ) ; while ( it . hasNext ( ) ) { it . advance ( ) ; float v = it . value ( ) / totalword ; it . setValue ( v ) ; int key = it . key ( ) ; if ( key < 0 ) continue ; Cluster cluster = new Cluster ( key , v , alpahbet . lookupString ( key ) ) ; clusters . put ( key , cluster ) ; } TIntObjectIterator < TIntFloatHashMap > it1 = pcc . iterator ( ) ; while ( it1 . hasNext ( ) ) { it1 . advance ( ) ; TIntFloatHashMap map = it1 . value ( ) ; TIntFloatIterator it2 = map . iterator ( ) ; while ( it2 . hasNext ( ) ) { it2 . advance ( ) ; it2 . setValue ( it2 . value ( ) / totalword ) ; } }
public class AbstrCFMLExprTransformer { /** * Liest den folgenden idetifier ein und prueft ob dieser ein boolscher Wert ist . Im Gegensatz zu * CFMX wird auch " yes " und " no " als bolscher < wert akzeptiert , was bei CFMX nur beim Umwandeln * einer Zeichenkette zu einem boolschen Wert der Fall ist . < br / > * Wenn es sich um keinen bolschen Wert handelt wird der folgende Wert eingelesen mit seiner ganzen * Hirarchie . < br / > * EBNF : < br / > * < code > " true " | " false " | " yes " | " no " | startElement { ( " . " identifier | " [ " structElement " ] " ) [ function ] } ; < / code > * @ return CFXD Element * @ throws TemplateException */ private Expression dynamic ( Data data ) throws TemplateException { } }
// Die Implementation weicht ein wenig von der Grammatik ab , // aber nicht in der Logik sondern rein wie es umgesetzt wurde . // get First Element of the Variable Position line = data . srcCode . getPosition ( ) ; Identifier id = identifier ( data , false , true ) ; if ( id == null ) { if ( ! data . srcCode . forwardIfCurrent ( '(' ) ) return null ; comments ( data ) ; Expression expr = assignOp ( data ) ; if ( ! data . srcCode . forwardIfCurrent ( ')' ) ) throw new TemplateException ( data . srcCode , "Invalid Syntax Closing [)] not found" ) ; comments ( data ) ; return expr ; // subDynamic ( expr ) ; } Variable var ; comments ( data ) ; // Boolean constant if ( id . getString ( ) . equalsIgnoreCase ( "TRUE" ) ) { // | | name . equals ( " YES " ) ) { comments ( data ) ; return id . getFactory ( ) . createLitBoolean ( true , line , data . srcCode . getPosition ( ) ) ; } else if ( id . getString ( ) . equalsIgnoreCase ( "FALSE" ) ) { // | | name . equals ( " NO " ) ) { comments ( data ) ; return id . getFactory ( ) . createLitBoolean ( false , line , data . srcCode . getPosition ( ) ) ; } else if ( id . getString ( ) . equalsIgnoreCase ( "NULL" ) && ! data . srcCode . isCurrent ( '.' ) && ! data . srcCode . isCurrent ( '[' ) ) { comments ( data ) ; return id . getFactory ( ) . createNullConstant ( line , data . srcCode . getPosition ( ) ) ; } // Extract Scope from the Variable var = startElement ( data , id , line ) ; var . setStart ( line ) ; var . setEnd ( data . srcCode . getPosition ( ) ) ; return var ;
public class ReplicatedTree { /** * Adds a new node to the tree and sets its data . If the node doesn not yet exist , it will be created . * Also , parent nodes will be created if not existent . If the node already has data , then the new data * will override the old one . If the node already existed , a nodeModified ( ) notification will be generated . * Otherwise a nodeCreated ( ) motification will be emitted . * @ param fqn The fully qualified name of the new node * @ param data The new data . May be null if no data should be set in the node . */ public void put ( String fqn , HashMap data ) { } }
if ( ! remote_calls ) { _put ( fqn , data ) ; return ; } // Changes done by < aos > // if true , propagate action to the group if ( send_message ) { if ( channel == null ) { if ( log . isErrorEnabled ( ) ) log . error ( "channel is null, cannot broadcast PUT request" ) ; return ; } try { channel . send ( new Message ( null , new Request ( Request . PUT , fqn , data ) ) ) ; } catch ( Exception ex ) { if ( log . isErrorEnabled ( ) ) log . error ( "failure bcasting PUT request: " + ex ) ; } } else { _put ( fqn , data ) ; }
public class Functions { /** * Create a token , from a clients point of view , for establishing a secure * communication channel . This is a client side token so it needs to bootstrap * the token creation . * @ param context GSSContext for which a connection has been established to the remote peer * @ return a byte [ ] that represents the token a client can send to a server for * establishing a secure communication channel . */ @ Function public static byte [ ] getClientToken ( GSSContext context ) { } }
byte [ ] initialToken = new byte [ 0 ] ; if ( ! context . isEstablished ( ) ) { try { // token is ignored on the first call initialToken = context . initSecContext ( initialToken , 0 , initialToken . length ) ; return getTokenWithLengthPrefix ( initialToken ) ; } catch ( GSSException ex ) { throw new RuntimeException ( "Exception getting client token" , ex ) ; } } return null ;
public class Utils { /** * Must call when epoll is available */ private static Class < ? extends ServerChannel > epollServerChannelType ( ) { } }
try { Class < ? extends ServerChannel > serverSocketChannel = Class . forName ( "io.netty.channel.epoll.EpollServerSocketChannel" ) . asSubclass ( ServerChannel . class ) ; return serverSocketChannel ; } catch ( ClassNotFoundException e ) { throw new RuntimeException ( "Cannot load EpollServerSocketChannel" , e ) ; }
public class Result { /** * For interval PSM return values */ public static Result newPSMResult ( int type , String label , Object value ) { } }
Result result = newResult ( ResultConstants . VALUE ) ; result . errorCode = type ; result . mainString = label ; result . valueData = value ; return result ;
public class AbstractConnectionManager { /** * { @ inheritDoc } */ public boolean dissociateManagedConnection ( Object connection , ManagedConnection mc , ManagedConnectionFactory mcf ) throws ResourceException { } }
log . tracef ( "dissociateManagedConnection(%s, %s, %s)" , connection , mc , mcf ) ; if ( connection == null || mc == null || mcf == null ) throw new ResourceException ( ) ; org . ironjacamar . core . connectionmanager . listener . ConnectionListener cl = pool . findConnectionListener ( mc , connection ) ; if ( cl != null ) { if ( ccm != null ) { ccm . unregisterConnection ( this , cl , connection ) ; } cl . removeConnection ( connection ) ; if ( cl . getConnections ( ) . isEmpty ( ) ) { pool . delist ( cl ) ; returnConnectionListener ( cl , false ) ; return true ; } } else { throw new ResourceException ( ) ; } return false ;
public class ImapHostManagerImpl { /** * Partial implementation of list functionality . * TODO : Handle wildcards anywhere in store pattern * ( currently only supported as last character of pattern ) * @ see com . icegreen . greenmail . imap . ImapHostManager # listMailboxes */ private Collection < MailFolder > listMailboxes ( GreenMailUser user , String mailboxPattern , boolean subscribedOnly ) throws FolderException { } }
List < MailFolder > mailboxes = new ArrayList < > ( ) ; String qualifiedPattern = getQualifiedMailboxName ( user , mailboxPattern ) ; for ( MailFolder folder : store . listMailboxes ( qualifiedPattern ) ) { // TODO check subscriptions . if ( subscribedOnly && ! subscriptions . isSubscribed ( user , folder ) ) { // if not subscribed folder = null ; } // Sets the store to null if it ' s not viewable . folder = checkViewable ( folder ) ; if ( folder != null ) { mailboxes . add ( folder ) ; } } return mailboxes ;
public class PGPUtils { /** * Performs the decryption of the given data . * @ param privateKey PGP Private Key to decrypt * @ param data encrypted data * @ param calculator instance of { @ link BcKeyFingerprintCalculator } * @ param targetStream stream to receive the decrypted data * @ throws PGPException if the decryption process fails * @ throws IOException if the stream write operation fails */ protected static void decryptData ( final PGPPrivateKey privateKey , final PGPPublicKeyEncryptedData data , final BcKeyFingerprintCalculator calculator , final OutputStream targetStream ) throws PGPException , IOException { } }
PublicKeyDataDecryptorFactory decryptorFactory = new JcePublicKeyDataDecryptorFactoryBuilder ( ) . setProvider ( PROVIDER ) . setContentProvider ( PROVIDER ) . build ( privateKey ) ; InputStream content = data . getDataStream ( decryptorFactory ) ; PGPObjectFactory plainFactory = new PGPObjectFactory ( content , calculator ) ; Object message = plainFactory . nextObject ( ) ; if ( message instanceof PGPCompressedData ) { PGPCompressedData compressedData = ( PGPCompressedData ) message ; PGPObjectFactory compressedFactory = new PGPObjectFactory ( compressedData . getDataStream ( ) , calculator ) ; message = compressedFactory . nextObject ( ) ; } if ( message instanceof PGPLiteralData ) { PGPLiteralData literalData = ( PGPLiteralData ) message ; try ( InputStream literalStream = literalData . getInputStream ( ) ) { IOUtils . copy ( literalStream , targetStream ) ; } } else if ( message instanceof PGPOnePassSignatureList ) { throw new PGPException ( "Encrypted message contains a signed message - not literal data." ) ; } else { throw new PGPException ( "Message is not a simple encrypted file - type unknown." ) ; } if ( data . isIntegrityProtected ( ) && ! data . verify ( ) ) { throw new PGPException ( "Message failed integrity check" ) ; }
public class QuartzScheduler { /** * Get the < code > { @ link ITrigger } < / code > instance with the given name and * group . */ public ITrigger getTrigger ( final TriggerKey triggerKey ) throws SchedulerException { } }
validateState ( ) ; return m_aResources . getJobStore ( ) . retrieveTrigger ( triggerKey ) ;
public class IdemixEnrollmentRequest { /** * Convert the enrollment request to a JSON object */ private JsonObject toJsonObject ( ) { } }
JsonObjectBuilder factory = Json . createObjectBuilder ( ) ; if ( idemixCredReq != null ) { factory . add ( "request" , idemixCredReq . toJsonObject ( ) ) ; } else { factory . add ( "request" , JsonValue . NULL ) ; } if ( caName != null ) { factory . add ( HFCAClient . FABRIC_CA_REQPROP , caName ) ; } return factory . build ( ) ;
public class MathUtil { /** * Replies the cosecant of the specified angle . * < p > < code > csc ( a ) = 1 / sin ( a ) < / code > * < p > < img src = " . / doc - files / trigo1 . png " alt = " [ Cosecant function ] " > * < img src = " . / doc - files / trigo3 . png " alt = " [ Cosecant function ] " > * @ param angle the angle . * @ return the cosecant of the angle . */ @ Pure @ Inline ( value = "1./Math.sin($1)" , imported = { } }
Math . class } ) public static double csc ( double angle ) { return 1. / Math . sin ( angle ) ;
public class WindowedStream { /** * Sets the { @ code Evictor } that should be used to evict elements from a window before emission . * < p > Note : When using an evictor window performance will degrade significantly , since * incremental aggregation of window results cannot be used . */ @ PublicEvolving public WindowedStream < T , K , W > evictor ( Evictor < ? super T , ? super W > evictor ) { } }
if ( windowAssigner instanceof BaseAlignedWindowAssigner ) { throw new UnsupportedOperationException ( "Cannot use a " + windowAssigner . getClass ( ) . getSimpleName ( ) + " with an Evictor." ) ; } this . evictor = evictor ; return this ;
public class CostlessMeldPairingHeap { /** * Append to decrease pool . */ @ SuppressWarnings ( "unchecked" ) private void addPool ( Node < K , V > n , boolean updateMinimum ) { } }
decreasePool [ decreasePoolSize ] = n ; n . poolIndex = decreasePoolSize ; decreasePoolSize ++ ; if ( updateMinimum && decreasePoolSize > 1 ) { Node < K , V > poolMin = decreasePool [ decreasePoolMinPos ] ; int c ; if ( comparator == null ) { c = ( ( Comparable < ? super K > ) n . key ) . compareTo ( poolMin . key ) ; } else { c = comparator . compare ( n . key , poolMin . key ) ; } if ( c < 0 ) { decreasePoolMinPos = n . poolIndex ; } }
public class AbstractJsonDeserializer { /** * Convenience method . Parses a string into a double . If it can no be converted to a double , the * defaultvalue is returned . Depending on your choice , you can allow null as output or assign it some value * and have very convenient syntax such as : double d = parseDefault ( myString , 0.0 ) ; which is a lot shorter * than dealing with all kinds of numberformatexceptions . * @ param input The inputstring * @ param defaultValue The value to assign in case of error * @ return A double corresponding with the input , or defaultValue if no double can be extracted */ public Double parseDefault ( String input , Double defaultValue ) { } }
if ( input == null ) { return defaultValue ; } Double answer = defaultValue ; try { answer = Double . parseDouble ( input ) ; } catch ( NumberFormatException ignored ) { } return answer ;
public class TableService { /** * region TableStore Implementation */ @ Override public CompletableFuture < Void > createSegment ( String segmentName , Duration timeout ) { } }
return invokeExtension ( segmentName , e -> e . createSegment ( segmentName , timeout ) , "createSegment" , segmentName ) ;
public class VisitorState { /** * Gets the original source code that represents the given node . * < p > Note that this may be different from what is returned by calling . toString ( ) on the node . * This returns exactly what is in the source code , whereas . toString ( ) pretty - prints the node * from its AST representation . * @ return the source code that represents the node . */ @ Nullable public String getSourceForNode ( Tree tree ) { } }
JCTree node = ( JCTree ) tree ; int start = node . getStartPosition ( ) ; int end = getEndPosition ( node ) ; if ( end < 0 ) { return null ; } return getSourceCode ( ) . subSequence ( start , end ) . toString ( ) ;
public class XCAInitiatingGatewayAuditor { /** * Audits an ITI - 43 Retrieve Document Set - b event for XCA Initiating Gateway actors . Audits as a XDS Document Registry . * @ param eventOutcome The event outcome indicator * @ param consumerUserId The Active Participant UserID for the document consumer ( if using WS - Addressing ) * @ param consumerUserName The Active Participant UserName for the document consumer ( if using WS - Security / XUA ) * @ param consumerIpAddress The IP address of the document consumer that initiated the transaction * @ param repositoryEndpointUri The Web service endpoint URI for this document repository * @ param documentUniqueIds The list of Document Entry UniqueId ( s ) for the document ( s ) retrieved * @ param repositoryUniqueIds The list of XDS . b Repository Unique Ids involved in this transaction ( aligned with Document Unique Ids array ) * @ param homeCommunityIds The list of XCA Home Community Ids involved in this transaction ( aligned with Document Unique Ids array ) * @ param purposesOfUse purpose of use codes ( may be taken from XUA token ) * @ param userRoles roles of the human user ( may be taken from XUA token ) */ public void auditRetrieveDocumentSetEvent ( RFC3881EventOutcomeCodes eventOutcome , String consumerUserId , String consumerUserName , String consumerIpAddress , String repositoryEndpointUri , String [ ] documentUniqueIds , String [ ] repositoryUniqueIds , String [ ] homeCommunityIds , List < CodedValueType > purposesOfUse , List < CodedValueType > userRoles ) { } }
if ( ! isAuditorEnabled ( ) ) { return ; } XDSRepositoryAuditor . getAuditor ( ) . auditRetrieveDocumentSetEvent ( eventOutcome , consumerUserId , consumerUserName , consumerIpAddress , repositoryEndpointUri , documentUniqueIds , repositoryUniqueIds , homeCommunityIds , purposesOfUse , userRoles ) ;
public class PortletsRESTController { /** * Provides information about all portlets in the portlet registry . NOTE : The response is * governed by the < code > IPermission . PORTLET _ MANAGER _ xyz < / code > series of permissions . The * actual level of permission required is based on the current lifecycle state of the portlet . */ @ RequestMapping ( value = "/portlets.json" , method = RequestMethod . GET ) public ModelAndView getManageablePortlets ( HttpServletRequest request , HttpServletResponse response ) throws Exception { } }
// get a list of all channels List < IPortletDefinition > allPortlets = portletDefinitionRegistry . getAllPortletDefinitions ( ) ; IAuthorizationPrincipal ap = getAuthorizationPrincipal ( request ) ; List < PortletTuple > rslt = new ArrayList < PortletTuple > ( ) ; for ( IPortletDefinition pdef : allPortlets ) { if ( ap . canManage ( pdef . getPortletDefinitionId ( ) . getStringId ( ) ) ) { rslt . add ( new PortletTuple ( pdef ) ) ; } } return new ModelAndView ( "json" , "portlets" , rslt ) ;
public class DelayWatcher { /** * - - - - - Constructor end */ @ Override public void onModify ( WatchEvent < ? > event , Path currentPath ) { } }
if ( this . delay < 1 ) { this . watcher . onModify ( event , currentPath ) ; } else { onDelayModify ( event , currentPath ) ; }
public class Duration { /** * Converts this duration to the total length in nanoseconds expressed as a { @ code long } . * If this duration is too large to fit in a { @ code long } nanoseconds , then an * exception is thrown . * @ return the total length of the duration in nanoseconds * @ throws ArithmeticException if numeric overflow occurs */ public long toNanos ( ) { } }
long totalNanos = Math . multiplyExact ( seconds , NANOS_PER_SECOND ) ; totalNanos = Math . addExact ( totalNanos , nanos ) ; return totalNanos ;
public class BackgroundCommandServiceJdo { /** * region > schedule ( API - deprecated ) */ @ Deprecated @ Programmatic @ Override public void schedule ( final ActionInvocationMemento aim , final Command parentCommand , final String targetClassName , final String targetActionName , final String targetArgs ) { } }
final CommandJdo backgroundCommand = newBackgroundCommand ( parentCommand , targetClassName , targetActionName , targetArgs ) ; backgroundCommand . setTargetStr ( aim . getTarget ( ) . toString ( ) ) ; backgroundCommand . setMemento ( aim . asMementoString ( ) ) ; backgroundCommand . setMemberIdentifier ( aim . getActionId ( ) ) ; repositoryService . persist ( backgroundCommand ) ;
public class TcpTransporter { /** * - - - LOCAL NODE ' S DESCRIPTOR - - - */ public NodeDescriptor getDescriptor ( ) { } }
cachedDescriptor . writeLock . lock ( ) ; try { // Check timestamp long current = registry . getTimestamp ( ) ; if ( timestamp . get ( ) == current ) { return cachedDescriptor ; } else { while ( true ) { current = registry . getTimestamp ( ) ; cachedDescriptor . info = registry . getDescriptor ( ) ; if ( current == registry . getTimestamp ( ) ) { timestamp . set ( current ) ; break ; } } cachedDescriptor . seq ++ ; cachedDescriptor . info . put ( "seq" , cachedDescriptor . seq ) ; cachedDescriptor . info . put ( "port" , reader . getCurrentPort ( ) ) ; } } finally { cachedDescriptor . writeLock . unlock ( ) ; } return cachedDescriptor ;
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link String } { @ code > } */ @ XmlElementDecl ( namespace = "http://docs.oasis-open.org/ns/cmis/messaging/200908/" , name = "filter" , scope = GetAppliedPolicies . class ) public JAXBElement < String > createGetAppliedPoliciesFilter ( String value ) { } }
return new JAXBElement < String > ( _GetPropertiesFilter_QNAME , String . class , GetAppliedPolicies . class , value ) ;
public class SshKeyPairGenerator { /** * Generates a new key pair . * @ param algorithm * @ param bits * @ return SshKeyPair * @ throws IOException */ public static SshKeyPair generateKeyPair ( String algorithm , int bits ) throws IOException , SshException { } }
if ( ! SSH2_RSA . equalsIgnoreCase ( algorithm ) && ! SSH2_DSA . equalsIgnoreCase ( algorithm ) ) { throw new IOException ( algorithm + " is not a supported key algorithm!" ) ; } SshKeyPair pair = new SshKeyPair ( ) ; if ( SSH2_RSA . equalsIgnoreCase ( algorithm ) ) { pair = ComponentManager . getInstance ( ) . generateRsaKeyPair ( bits ) ; } else { pair = ComponentManager . getInstance ( ) . generateDsaKeyPair ( bits ) ; } return pair ;
public class RBACModel { /** * - - - - - inherited methods - - - - - */ @ Override public boolean isAuthorizedForTransaction ( String subject , String transaction ) throws CompatibilityException { } }
getContext ( ) . validateSubject ( subject ) ; getContext ( ) . validateActivity ( transaction ) ; if ( ! roleMembershipUR . containsKey ( subject ) ) return false ; for ( String role : getRolesFor ( subject , true ) ) if ( rolePermissions . isAuthorizedForTransaction ( role , transaction ) ) return true ; return false ;
public class MockScanner { /** * Scan and prepare mocks for the given < code > testClassInstance < / code > and < code > clazz < / code > in the type hierarchy . * @ return A prepared set of mock */ private Set < Object > scan ( ) { } }
Set < Object > mocks = newMockSafeHashSet ( ) ; for ( Field field : clazz . getDeclaredFields ( ) ) { // mock or spies only FieldReader fieldReader = new FieldReader ( instance , field ) ; Object mockInstance = preparedMock ( fieldReader . read ( ) , field ) ; if ( mockInstance != null ) { mocks . add ( mockInstance ) ; } } return mocks ;