signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class Shape { /** * Returns the order given the shape information
* @ param buffer the buffer
* @ return */
@ Deprecated public static void setOrder ( IntBuffer buffer , char order ) { } } | int length = Shape . shapeInfoLength ( Shape . rank ( buffer ) ) ; buffer . put ( length - 1 , ( int ) order ) ; throw new RuntimeException ( "setOrder called" ) ; |
public class TreeTableExample { /** * Creates and configures the table to be used by the example . The table is configured with global rather than user
* data . Although this is not a realistic scenario , it will suffice for this example .
* @ return a new configured table . */
private WDataTable createTable ( ) { } } | WDataTable tbl = new WDataTable ( ) ; tbl . addColumn ( new WTableColumn ( "First name" , new WTextField ( ) ) ) ; tbl . addColumn ( new WTableColumn ( "Last name" , new WTextField ( ) ) ) ; tbl . addColumn ( new WTableColumn ( "DOB" , new WDateField ( ) ) ) ; tbl . setExpandMode ( ExpandMode . CLIENT ) ; TableTreeNode root = createTree ( ) ; tbl . setDataModel ( new ExampleTreeTableModel ( root ) ) ; return tbl ; |
public class ParameterList { /** * Replace any parameters of the same type with the one specified .
* @ param parameter parameter to add to this list in place of all others with the same name
* @ return true if successfully added to this list */
public final boolean replace ( final Parameter parameter ) { } } | for ( Parameter parameter1 : getParameters ( parameter . getName ( ) ) ) { remove ( parameter1 ) ; } return add ( parameter ) ; |
public class DatabaseSequenceElementIdProvider { /** * Gets the identifier value from a neo4j { @ link Entity } .
* @ param entity The neo4j { @ link Entity } .
* @ return The neo4j { @ link Entity } identifier . */
@ Override public Long get ( Entity entity ) { } } | Objects . requireNonNull ( entity , "entity cannot be null" ) ; // return property value
return entity . get ( idFieldName ) . asLong ( ) ; |
public class MutableURI { /** * Sets ( and resets ) the query string .
* This method assumes that the query is already encoded and escaped .
* @ param query Query string */
public void setQuery ( String query ) { } } | _parameters = null ; if ( query == null || query . length ( ) == 0 ) { return ; } for ( StringTokenizer tok = new StringTokenizer ( query , "&" ) ; tok . hasMoreElements ( ) ; ) { String queryItem = tok . nextToken ( ) ; if ( queryItem . startsWith ( "amp;" ) ) { queryItem = queryItem . substring ( 4 ) ; } int eq = queryItem . indexOf ( '=' ) ; if ( eq != - 1 ) { addParameter ( queryItem . substring ( 0 , eq ) , queryItem . substring ( eq + 1 ) , true ) ; } else { addParameter ( queryItem , null , true ) ; } } |
public class JarUtils { /** * Convert a classfile path to the corresponding class name .
* @ param classfilePath
* the classfile path
* @ return the class name */
public static String classfilePathToClassName ( final String classfilePath ) { } } | if ( ! classfilePath . endsWith ( ".class" ) ) { throw new IllegalArgumentException ( "Classfile path does not end with \".class\": " + classfilePath ) ; } return classfilePath . substring ( 0 , classfilePath . length ( ) - 6 ) . replace ( '/' , '.' ) ; |
public class WSKeyStore { /** * Store the current information into the wrapped keystore .
* @ throws Exception */
public void store ( ) throws Exception { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "store" ) ; try { String name = getProperty ( Constants . SSLPROP_KEY_STORE_NAME ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Storing KeyStore " + name ) ; String SSLKeyFile = getProperty ( Constants . SSLPROP_KEY_STORE ) ; String SSLKeyPassword = decodePassword ( getProperty ( Constants . SSLPROP_KEY_STORE_PASSWORD ) ) ; String SSLKeyStoreType = getProperty ( Constants . SSLPROP_KEY_STORE_TYPE ) ; boolean readOnly = Boolean . parseBoolean ( getProperty ( Constants . SSLPROP_KEY_STORE_READ_ONLY ) ) ; boolean fileBased = Boolean . parseBoolean ( getProperty ( Constants . SSLPROP_KEY_STORE_FILE_BASED ) ) ; String SSLKeyStoreStash = getProperty ( Constants . SSLPROP_KEY_STORE_CREATE_CMS_STASH ) ; KeyStore ks = getKeyStore ( false , false ) ; if ( ks != null && ! readOnly ) { if ( fileBased ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Storing filebased keystore type " + SSLKeyStoreType ) ; String keyStoreLocation = SSLKeyFile ; String keyStorePassword = SSLKeyPassword ; final FileOutputStream fos = new FileOutputStream ( keyStoreLocation ) ; try { ks . store ( fos , keyStorePassword . toCharArray ( ) ) ; } finally { fos . close ( ) ; } } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Storing non-filebased keystore type " + SSLKeyStoreType ) ; String keyStoreLocation = SSLKeyFile ; String keyStorePassword = SSLKeyPassword ; URL ring = new URL ( keyStoreLocation ) ; URLConnection ringConnect = ring . openConnection ( ) ; final OutputStream fos = ringConnect . getOutputStream ( ) ; try { ks . store ( fos , keyStorePassword . toCharArray ( ) ) ; } finally { fos . close ( ) ; } } } // we will likely have to store other types too
} catch ( Exception e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Exception storing KeyStore; " + e ) ; FFDCFilter . processException ( e , getClass ( ) . getName ( ) , "store" , this ) ; throw e ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "store" ) ; |
public class InfluentialContributorSet { /** * Determines whether the Twitter status is related to one of the users in the
* set of influential contributors .
* @ param sender
* if the person who created the status is in the ids set , return
* true
* @ param userMentions
* if the status contains a user mention that is contained in the ids
* set , return true
* @ param retweetOrigin
* if the status is a retweet that was originated by a user in the
* ids set , return true
* @ returns true if one of the ids in the input parameter matches an id found
* in the tweet */
public boolean isTwitterJsonStringRelatedTo ( String tweet , boolean sender , boolean userMentions , boolean retweetOrigin ) { } } | StatusRepresentation s = new StatusRepresentation ( ) ; s . init ( null , tweet ) ; boolean matches = s . isRelatedTo ( this , true , true , true ) ; return matches ; |
public class SnowflakeDatabaseMetaData { /** * apply session context when catalog is unspecified */
private SFPair < String , String > applySessionContext ( String catalog , String schemaPattern ) { } } | if ( catalog == null && metadataRequestUseConnectionCtx ) { catalog = session . getDatabase ( ) ; if ( schemaPattern == null ) { schemaPattern = session . getSchema ( ) ; } } return SFPair . of ( catalog , schemaPattern ) ; |
public class HtmlOutcomeTargetLink { /** * < p > Return the value of the < code > onkeypress < / code > property . < / p >
* < p > Contents : Javascript code executed when a key is
* pressed and released over this element . */
public java . lang . String getOnkeypress ( ) { } } | return ( java . lang . String ) getStateHelper ( ) . eval ( PropertyKeys . onkeypress ) ; |
public class BottomUpUnionAndBindingLiftOptimizer { /** * Recursive ( to reach the descendency but does not loop over itself ) */
private IQTree liftTree ( IQTree queryTree , VariableGenerator variableGenerator ) { } } | if ( queryTree instanceof UnaryIQTree ) return liftUnary ( ( UnaryIQTree ) queryTree , variableGenerator ) ; else if ( queryTree instanceof NaryIQTree ) return liftNary ( ( NaryIQTree ) queryTree , variableGenerator ) ; else if ( queryTree instanceof BinaryNonCommutativeIQTree ) return liftBinaryNonCommutative ( ( BinaryNonCommutativeIQTree ) queryTree , variableGenerator ) ; // Leaf node
else return queryTree ; |
public class CloudRedisClient { /** * Updates the metadata and configuration of a specific Redis instance .
* < p > Completed longrunning . Operation will contain the new instance object in the response field .
* The returned operation is automatically deleted after a few hours , so there is no need to call
* DeleteOperation .
* < p > Sample code :
* < pre > < code >
* try ( CloudRedisClient cloudRedisClient = CloudRedisClient . create ( ) ) {
* String pathsElement = " display _ name " ;
* String pathsElement2 = " memory _ size _ gb " ;
* List & lt ; String & gt ; paths = Arrays . asList ( pathsElement , pathsElement2 ) ;
* FieldMask updateMask = FieldMask . newBuilder ( )
* . addAllPaths ( paths )
* . build ( ) ;
* String displayName = " UpdatedDisplayName " ;
* int memorySizeGb = 4;
* Instance instance = Instance . newBuilder ( )
* . setDisplayName ( displayName )
* . setMemorySizeGb ( memorySizeGb )
* . build ( ) ;
* Instance response = cloudRedisClient . updateInstanceAsync ( updateMask , instance ) . get ( ) ;
* < / code > < / pre >
* @ param updateMask Required . Mask of fields to update . At least one path must be supplied in
* this field . The elements of the repeated paths field may only include these fields from
* [ Instance ] [ google . cloud . redis . v1beta1 . Instance ] :
* < p > & # 42 ; ` displayName ` & # 42 ; ` labels ` & # 42 ; ` memorySizeGb ` & # 42 ; ` redisConfig `
* @ param instance Required . Update description . Only fields specified in update _ mask are updated .
* @ throws com . google . api . gax . rpc . ApiException if the remote call fails */
@ BetaApi ( "The surface for long-running operations is not stable yet and may change in the future." ) public final OperationFuture < Instance , Any > updateInstanceAsync ( FieldMask updateMask , Instance instance ) { } } | UpdateInstanceRequest request = UpdateInstanceRequest . newBuilder ( ) . setUpdateMask ( updateMask ) . setInstance ( instance ) . build ( ) ; return updateInstanceAsync ( request ) ; |
public class PseudoNthSpecifierChecker { /** * Add { @ code : nth - last - child } elements .
* @ see < a href = " http : / / www . w3 . org / TR / css3 - selectors / # nth - last - child - pseudo " > < code > : nth - last - child < / code > pseudo - class < / a > */
private void addNthLastChild ( ) { } } | for ( Node node : nodes ) { int count = 1 ; Node n = DOMHelper . getNextSiblingElement ( node ) ; while ( n != null ) { count ++ ; n = DOMHelper . getNextSiblingElement ( n ) ; } if ( specifier . isMatch ( count ) ) { result . add ( node ) ; } } |
public class UserAgentDirectives { /** * Match the current user agent directive set with the given
* user agent . The returned value will be the maximum match length
* of any user agent .
* @ param userAgent The user agent used by the crawler
* @ return The maximum length of a matching user agent in this set of directives */
public int match ( String userAgent ) { } } | userAgent = userAgent . toLowerCase ( ) ; int maxLength = 0 ; for ( String ua : userAgents ) { if ( ua . equals ( "*" ) || userAgent . contains ( ua ) ) { maxLength = Math . max ( maxLength , ua . length ( ) ) ; } } return maxLength ; |
public class JDBCDatabaseMetaData { /** * # ifdef JAVA4 */
public ResultSet getAttributes ( String catalog , String schemaPattern , String typeNamePattern , String attributeNamePattern ) throws SQLException { } } | StringBuffer select = toQueryPrefixNoSelect ( "SELECT TABLE_NAME AS TYPE_CAT, TABLE_NAME AS TYPE_SCHME, TABLE_NAME AS TYPE_NAME, " + "TABLE_NAME AS ATTR_NAME, CAST(0 AS INTEGER) AS DATA_TYPE, TABLE_NAME AS ATTR_TYPE_NAME, " + "CAST(0 AS INTEGER) AS ATTR_SIZE, CAST(0 AS INTEGER) AS DECIMAL_DIGITS, " + "CAST(0 AS INTEGER) AS NUM_PREC_RADIX, CAST(0 AS INTEGER) AS NULLABLE, " + "'' AS REMARK, '' AS ATTR_DEF, CAST(0 AS INTEGER) AS SQL_DATA_TYPE, " + "CAST(0 AS INTEGER) AS SQL_DATETIME_SUB, CAST(0 AS INTEGER) AS CHAR_OCTECT_LENGTH, " + "CAST(0 AS INTEGER) AS ORDINAL_POSITION, '' AS NULLABLE, " + "'' AS SCOPE_CATALOG, '' AS SCOPE_SCHEMA, '' AS SCOPE_TABLE, " + "CAST(0 AS SMALLINT) AS SCOPE_DATA_TYPE " + "FROM INFORMATION_SCHEMA.TABLES " ) . append ( and ( "TABLE_NAME" , "=" , "" ) ) ; return execute ( select . toString ( ) ) ; |
public class CommandBuilder { /** * Adds the string value of the given option argument to the command .
* For example , to add " - name myFile " to construct the command " find . - name myFile " , opt should
* be " - name " and arg should be " myFile " .
* @ param opt the option flag
* @ param arg the argument
* @ return the { @ link CommandBuilder } with the argument added */
public CommandBuilder addArg ( String opt , Object arg ) { } } | mArgs . add ( opt + " " + String . valueOf ( arg ) ) ; return this ; |
public class TrafficForecastAdjustment { /** * Gets the filterCriteria value for this TrafficForecastAdjustment .
* @ return filterCriteria * Filter criteria defining the slice of inventory to which the
* adjustment is assigned . */
public com . google . api . ads . admanager . axis . v201902 . TrafficTimeSeriesFilterCriteria getFilterCriteria ( ) { } } | return filterCriteria ; |
public class StencilEngine { /** * Loads the given text as a template
* @ param text Template text
* @ return Loaded template
* @ throws IOException
* @ throws ParseException */
public Template loadInline ( String text ) throws IOException , ParseException { } } | try ( InlineTemplateSource templateSource = new InlineTemplateSource ( text ) ) { return load ( "inline" , templateSource ) ; } |
public class BuilderImpl { /** * ( non - Javadoc )
* @ see com . ibm . ws . security . jwt . internal . Builder # claim ( java . lang . String , java . lang . Object ) */
@ Override public Builder claim ( String name , Object value ) throws InvalidClaimException { } } | if ( isValidClaim ( name , value ) ) { if ( name . equals ( Claims . AUDIENCE ) ) { if ( value instanceof ArrayList ) { this . audience ( ( ArrayList ) value ) ; } else if ( value instanceof String ) { String [ ] auds = ( ( String ) value ) . split ( " " ) ; ArrayList < String > audList = new ArrayList < String > ( ) ; for ( String aud : auds ) { if ( ! aud . isEmpty ( ) ) { audList . add ( aud . trim ( ) ) ; } } if ( ! audList . isEmpty ( ) ) { this . audience ( audList ) ; } } else { String msg = Tr . formatMessage ( tc , "JWT_INVALID_CLAIM_VALUE_TYPE" , new Object [ ] { Claims . AUDIENCE } ) ; throw new InvalidClaimException ( msg ) ; } } else if ( name . equals ( Claims . EXPIRATION ) ) { if ( value instanceof Long ) { this . expirationTime ( ( Long ) value ) ; } else if ( value instanceof Integer ) { this . expirationTime ( ( ( Integer ) value ) . longValue ( ) ) ; } else { String msg = Tr . formatMessage ( tc , "JWT_INVALID_CLAIM_VALUE_TYPE" , new Object [ ] { Claims . EXPIRATION } ) ; throw new InvalidClaimException ( msg ) ; } } else if ( name . equals ( Claims . ISSUED_AT ) ) { if ( value instanceof Long ) { this . issueTime ( ( Long ) value ) ; } else if ( value instanceof Integer ) { this . expirationTime ( ( ( Integer ) value ) . longValue ( ) ) ; } else { String msg = Tr . formatMessage ( tc , "JWT_INVALID_CLAIM_VALUE_TYPE" , new Object [ ] { Claims . ISSUED_AT } ) ; throw new InvalidClaimException ( msg ) ; } } else if ( name . equals ( Claims . NOT_BEFORE ) ) { if ( value instanceof Long ) { this . notBefore ( ( Long ) value ) ; } else if ( value instanceof Integer ) { this . expirationTime ( ( ( Integer ) value ) . longValue ( ) ) ; } else { String msg = Tr . formatMessage ( tc , "JWT_INVALID_CLAIM_VALUE_TYPE" , new Object [ ] { Claims . NOT_BEFORE } ) ; throw new InvalidClaimException ( msg ) ; } } else if ( name . equals ( Claims . ISSUER ) || name . equals ( Claims . SUBJECT ) ) { if ( value instanceof String ) { if ( name . equals ( Claims . ISSUER ) ) { this . issuer ( ( String ) value ) ; } else { this . subject ( ( String ) value ) ; } } else { String msg = Tr . formatMessage ( tc , "JWT_INVALID_CLAIM_VALUE_TYPE" , new Object [ ] { name } ) ; throw new InvalidClaimException ( msg ) ; } } else { claims . put ( name , value ) ; } } return this ; |
public class PersistenceUnitComponent { /** * @ see
* javax . persistence . spi . PersistenceUnitInfo # getPersistenceUnitRootUrl ( ) */
@ Override public URL getPersistenceUnitRootUrl ( ) { } } | // Make one that is OSGi based , it relies on the ' location ' property
String loc = location ; int n = loc . lastIndexOf ( '/' ) ; if ( n > 0 ) { loc = loc . substring ( 0 , n ) ; } if ( loc . isEmpty ( ) ) { loc = "/" ; } return sourceBundle . bundle . getResource ( loc ) ; |
public class CmsXmlContentTypeManager { /** * Returns an alphabetically sorted list of all configured XML content schema types . < p >
* @ return an alphabetically sorted list of all configured XML content schema types */
public List < I_CmsXmlSchemaType > getRegisteredSchemaTypes ( ) { } } | List < I_CmsXmlSchemaType > result = new ArrayList < I_CmsXmlSchemaType > ( m_registeredTypes . values ( ) ) ; Collections . sort ( result ) ; return result ; |
public class SubClass { /** * Returns the constant map index to class
* If entry doesn ' t exist it is created .
* @ param arrayType
* @ return */
public final int resolveClassIndex ( ArrayType arrayType ) { } } | int size = 0 ; int index = 0 ; constantReadLock . lock ( ) ; try { size = getConstantPoolSize ( ) ; index = getClassIndex ( arrayType ) ; } finally { constantReadLock . unlock ( ) ; } if ( index == - 1 ) { String name = Descriptor . getFieldDesriptor ( arrayType ) ; int nameIndex = resolveNameIndex ( name ) ; index = addConstantInfo ( new Clazz ( nameIndex ) , size ) ; } addIndexedElement ( index , arrayType ) ; return index ; |
public class TaggedArgumentParser { /** * Process a single option and add it to the curated args list . If the option is tagged , add the
* curated key and value . Otherwise just add the raw option .
* @ param optionPrefix the actual option prefix used for this option , either " - " or " - - "
* @ param optionString the option string including everything but the prefix
* @ param userArgIt iterator of raw arguments provided by the user , used to retrieve the value corresponding
* to this option
* @ param finalArgList the curated argument list */
private void replaceTaggedOption ( final String optionPrefix , // the option prefix used ( short or long )
final String optionString , // the option string , minus prefix , including any tags / attributes
final Iterator < String > userArgIt , // the original , raw , un - curated input argument list
final List < String > finalArgList // final , curated argument list
) { } } | final int separatorIndex = optionString . indexOf ( TaggedArgumentParser . ARGUMENT_TAG_NAME_SEPARATOR ) ; if ( separatorIndex == - 1 ) { // no tags , consume one argument and get out
detectAndRejectHybridSyntax ( optionString ) ; finalArgList . add ( optionPrefix + optionString ) ; } else { final String optionName = optionString . substring ( 0 , separatorIndex ) ; detectAndRejectHybridSyntax ( optionName ) ; if ( userArgIt . hasNext ( ) ) { if ( optionName . isEmpty ( ) ) { throw new CommandLineException ( "Zero length argument name found in tagged argument: " + optionString ) ; } final String tagNameAndValues = optionString . substring ( separatorIndex + 1 , optionString . length ( ) ) ; if ( tagNameAndValues . isEmpty ( ) ) { throw new CommandLineException ( "Zero length tag name found in tagged argument: " + optionString ) ; } final String argValue = userArgIt . next ( ) ; if ( isLongOptionToken ( argValue ) || isShortOptionToken ( argValue ) ) { // An argument value is required , and there isn ' t one to consume
throw new CommandLineException ( "No argument value found for tagged argument: " + optionString ) ; } // Replace the original prefix / option / attribute string with the original prefix / option name , and
// replace it ' s companion argument value with the surrogate key to be used later to retrieve the
// actual values
final String pairKey = getSurrogateKeyForTaggedOption ( optionString , argValue , tagNameAndValues ) ; finalArgList . add ( optionPrefix + optionName ) ; finalArgList . add ( pairKey ) ; } else { // the option appears to be tagged , but we ' re already at the end of the argument list ,
// and there is no companion value to use
throw new CommandLineException ( "No argument value found for tagged argument: " + optionString ) ; } } |
public class DisableEnhancedMonitoringRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DisableEnhancedMonitoringRequest disableEnhancedMonitoringRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( disableEnhancedMonitoringRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( disableEnhancedMonitoringRequest . getStreamName ( ) , STREAMNAME_BINDING ) ; protocolMarshaller . marshall ( disableEnhancedMonitoringRequest . getShardLevelMetrics ( ) , SHARDLEVELMETRICS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class DragPinchListener { /** * Calculates the distance between the 2 current pointers */
private float distance ( MotionEvent event ) { } } | if ( event . getPointerCount ( ) < 2 ) { return 0 ; } return PointF . length ( event . getX ( POINTER1 ) - event . getX ( POINTER2 ) , event . getY ( POINTER1 ) - event . getY ( POINTER2 ) ) ; |
public class ChatController { /** * Limits number of conversations to check and synchronise . Emty conversations wont be synchronised . The synchronisation will take place for twenty conversations updated most recently .
* @ param conversations List of conversations to be limited .
* @ return Limited list of conversations to update . */
private List < ChatConversation > limitNumberOfConversations ( List < ChatConversation > conversations ) { } } | List < ChatConversation > noEmptyConversations = new ArrayList < > ( ) ; for ( ChatConversation c : conversations ) { if ( c . getLastRemoteEventId ( ) != null && c . getLastRemoteEventId ( ) >= 0 ) { noEmptyConversations . add ( c ) ; } } List < ChatConversation > limitedList ; if ( noEmptyConversations . size ( ) <= maxConversationsSynced ) { limitedList = noEmptyConversations ; } else { SortedMap < Long , ChatConversation > sorted = new TreeMap < > ( ) ; for ( ChatConversation conversation : noEmptyConversations ) { Long updatedOn = conversation . getUpdatedOn ( ) ; if ( updatedOn != null ) { sorted . put ( updatedOn , conversation ) ; } } limitedList = new ArrayList < > ( ) ; Object [ ] array = sorted . values ( ) . toArray ( ) ; for ( int i = 0 ; i < Math . min ( maxConversationsSynced , array . length ) ; i ++ ) { limitedList . add ( ( ChatConversation ) array [ i ] ) ; } } return limitedList ; |
public class InternalSimpleExpressionsParser { /** * InternalSimpleExpressions . g : 408:1 : entryRuleAtom returns [ EObject current = null ] : iv _ ruleAtom = ruleAtom EOF ; */
public final EObject entryRuleAtom ( ) throws RecognitionException { } } | EObject current = null ; EObject iv_ruleAtom = null ; try { // InternalSimpleExpressions . g : 409:2 : ( iv _ ruleAtom = ruleAtom EOF )
// InternalSimpleExpressions . g : 410:2 : iv _ ruleAtom = ruleAtom EOF
{ newCompositeNode ( grammarAccess . getAtomRule ( ) ) ; pushFollow ( FOLLOW_1 ) ; iv_ruleAtom = ruleAtom ( ) ; state . _fsp -- ; current = iv_ruleAtom ; match ( input , EOF , FOLLOW_2 ) ; } } catch ( RecognitionException re ) { recover ( input , re ) ; appendSkippedTokens ( ) ; } finally { } return current ; |
public class WarehouseRest { /** * < p > Setter for invItem . < / p >
* @ param pInvItem reference */
public final void setInvItem ( final InvItem pInvItem ) { } } | this . invItem = pInvItem ; if ( this . itsId == null ) { this . itsId = new WarehouseRestId ( ) ; } this . itsId . setInvItem ( this . invItem ) ; |
public class TechnologyTagService { /** * Adds the provided tag to the provided { @ link FileModel } . If a { @ link TechnologyTagModel } cannot be found with the provided name , then one will
* be created . */
public TechnologyTagModel addTagToFileModel ( FileModel fileModel , String tagName , TechnologyTagLevel level ) { } } | Traversable < Vertex , Vertex > q = getGraphContext ( ) . getQuery ( TechnologyTagModel . class ) . traverse ( g -> g . has ( TechnologyTagModel . NAME , tagName ) ) ; TechnologyTagModel technologyTag = super . getUnique ( q . getRawTraversal ( ) ) ; if ( technologyTag == null ) { technologyTag = create ( ) ; technologyTag . setName ( tagName ) ; technologyTag . setLevel ( level ) ; } if ( level == TechnologyTagLevel . IMPORTANT && fileModel instanceof SourceFileModel ) ( ( SourceFileModel ) fileModel ) . setGenerateSourceReport ( true ) ; technologyTag . addFileModel ( fileModel ) ; return technologyTag ; |
public class CamelEndpointDeployerService { /** * This method can simplified substantially , once https : / / github . com / undertow - io / undertow / pull / 642 reaches us .
* Currently , the method is just an adjusted copy of { @ link DeploymentInfo # clone ( ) } .
* @ param src the { @ link DeploymentInfo } to clone and adapt
* @ param uri the { @ link URI } of the CXF endpoint
* @ param servletInfo of the servlet that will serve the endpoint
* @ return a new adapted { @ link DeploymentInfo } */
static DeploymentInfo adaptDeploymentInfo ( DeploymentInfo src , URI uri , ServletInfo servletInfo ) { } } | final String contextPath = uri . getPath ( ) ; final String deploymentName = src . getDeploymentName ( ) + ":" + uri . getPath ( ) ; final DeploymentInfo info = new DeploymentInfo ( ) . setClassLoader ( src . getClassLoader ( ) ) . setContextPath ( contextPath ) . setResourceManager ( src . getResourceManager ( ) ) . setMajorVersion ( src . getMajorVersion ( ) ) . setMinorVersion ( src . getMinorVersion ( ) ) . setDeploymentName ( deploymentName ) . setClassIntrospecter ( src . getClassIntrospecter ( ) ) ; info . addServlet ( servletInfo ) ; for ( Map . Entry < String , FilterInfo > e : src . getFilters ( ) . entrySet ( ) ) { info . addFilter ( e . getValue ( ) . clone ( ) ) ; } info . setDisplayName ( src . getDisplayName ( ) ) ; for ( FilterMappingInfo fmi : src . getFilterMappings ( ) ) { switch ( fmi . getMappingType ( ) ) { case URL : info . addFilterUrlMapping ( fmi . getFilterName ( ) , fmi . getMapping ( ) , fmi . getDispatcher ( ) ) ; break ; case SERVLET : info . addFilterServletNameMapping ( fmi . getFilterName ( ) , fmi . getMapping ( ) , fmi . getDispatcher ( ) ) ; break ; default : throw new IllegalStateException ( "Unexpected " + io . undertow . servlet . api . FilterMappingInfo . MappingType . class . getName ( ) + " " + fmi . getMappingType ( ) ) ; } } final List < ListenerInfo > listeners = src . getListeners ( ) ; final List < String > approvedListeners = Arrays . asList ( "org.wildfly.extension.undertow.deployment.JspInitializationListener" , "org.jboss.weld.module.web.servlet.WeldInitialListener" , "org.jboss.weld.module.web.servlet.WeldTerminalListener" , "org.wildfly.microprofile.opentracing.smallrye.TracerInitializer" ) ; final String infoServiceListenerClassNamePrefix = UndertowDeploymentInfoService . class . getName ( ) + "$" ; for ( ListenerInfo listenerInfo : listeners ) { CamelLogger . LOGGER . debug ( "Copying ListenerInfo {}" , listenerInfo ) ; if ( listenerInfo . getListenerClass ( ) . getName ( ) . startsWith ( infoServiceListenerClassNamePrefix ) ) { /* ignore */
} else { assert approvedListeners . stream ( ) . anyMatch ( cl -> cl . equals ( listenerInfo . getListenerClass ( ) . getName ( ) ) ) : "Unexpected " + ListenerInfo . class . getName ( ) + ": " + listenerInfo + "; expected any of [" + approvedListeners . stream ( ) . collect ( Collectors . joining ( ", " ) ) + "]" ; info . addListener ( listenerInfo ) ; } } info . addServletContainerInitalizers ( src . getServletContainerInitializers ( ) ) ; for ( ThreadSetupHandler a : src . getThreadSetupActions ( ) ) { info . addThreadSetupAction ( a ) ; } for ( Entry < String , String > en : src . getInitParameters ( ) . entrySet ( ) ) { info . addInitParameter ( en . getKey ( ) , en . getValue ( ) ) ; } for ( Entry < String , Object > en : src . getServletContextAttributes ( ) . entrySet ( ) ) { if ( WebSocketDeploymentInfo . ATTRIBUTE_NAME . equals ( en . getKey ( ) ) ) { final WebSocketDeploymentInfo srcWsdi = ( WebSocketDeploymentInfo ) en . getValue ( ) ; /* Simplify start
* Once https : / / github . com / undertow - io / undertow / pull / 672 reaches us
* the follwing code can be simplified using the newly added WebSocketDeploymentInfo methods clone ( )
* and [ get | add ] Listeners ( ) */
final WebSocketDeploymentInfo targetWsdi = new WebSocketDeploymentInfo ( ) . setWorker ( srcWsdi . getWorker ( ) ) . setBuffers ( srcWsdi . getBuffers ( ) ) . setDispatchToWorkerThread ( srcWsdi . isDispatchToWorkerThread ( ) ) . setReconnectHandler ( srcWsdi . getReconnectHandler ( ) ) ; targetWsdi . setClientBindAddress ( srcWsdi . getClientBindAddress ( ) ) ; srcWsdi . getAnnotatedEndpoints ( ) . stream ( ) . forEach ( e -> targetWsdi . addEndpoint ( e ) ) ; srcWsdi . getProgramaticEndpoints ( ) . stream ( ) . forEach ( e -> targetWsdi . addEndpoint ( e ) ) ; srcWsdi . getExtensions ( ) . stream ( ) . forEach ( e -> targetWsdi . addExtension ( e ) ) ; try { final Field containerReadyListenersField = srcWsdi . getClass ( ) . getDeclaredField ( "containerReadyListeners" ) ; containerReadyListenersField . setAccessible ( true ) ; @ SuppressWarnings ( "unchecked" ) final List < ContainerReadyListener > containerReadyListeners = ( List < ContainerReadyListener > ) containerReadyListenersField . get ( srcWsdi ) ; assert containerReadyListeners . stream ( ) . anyMatch ( l -> l . getClass ( ) . getName ( ) . startsWith ( infoServiceListenerClassNamePrefix ) ) : infoServiceListenerClassNamePrefix + "* not found in " + WebSocketDeploymentInfo . class . getSimpleName ( ) + ".containerReadyListeners" ; assert containerReadyListeners . size ( ) == 1 : WebSocketDeploymentInfo . class . getSimpleName ( ) + ".containerReadyListeners.size() expected 1, actual " + listeners . size ( ) ; } catch ( NoSuchFieldException | SecurityException | IllegalAccessException e1 ) { throw new RuntimeException ( e1 ) ; } /* Simplify end */
} else { info . addServletContextAttribute ( en . getKey ( ) , en . getValue ( ) ) ; } } info . addWelcomePages ( src . getWelcomePages ( ) ) ; info . addErrorPages ( src . getErrorPages ( ) ) ; info . addMimeMappings ( src . getMimeMappings ( ) ) ; info . setExecutor ( src . getExecutor ( ) ) ; info . setAsyncExecutor ( src . getAsyncExecutor ( ) ) ; info . setTempDir ( src . getTempDir ( ) ) ; info . setJspConfigDescriptor ( src . getJspConfigDescriptor ( ) ) ; info . setDefaultServletConfig ( src . getDefaultServletConfig ( ) ) ; for ( Entry < String , String > en : src . getLocaleCharsetMapping ( ) . entrySet ( ) ) { info . addLocaleCharsetMapping ( en . getKey ( ) , en . getValue ( ) ) ; } info . setSessionManagerFactory ( src . getSessionManagerFactory ( ) ) ; final LoginConfig loginConfig = src . getLoginConfig ( ) ; if ( loginConfig != null ) { info . setLoginConfig ( loginConfig . clone ( ) ) ; } info . setIdentityManager ( src . getIdentityManager ( ) ) ; info . setConfidentialPortManager ( src . getConfidentialPortManager ( ) ) ; info . setDefaultEncoding ( src . getDefaultEncoding ( ) ) ; info . setUrlEncoding ( src . getUrlEncoding ( ) ) ; info . addSecurityConstraints ( filterConstraints ( src , uri ) ) ; for ( HandlerWrapper w : src . getOuterHandlerChainWrappers ( ) ) { info . addOuterHandlerChainWrapper ( w ) ; } for ( HandlerWrapper w : src . getInnerHandlerChainWrappers ( ) ) { info . addInnerHandlerChainWrapper ( w ) ; } info . setInitialSecurityWrapper ( src . getInitialSecurityWrapper ( ) ) ; for ( HandlerWrapper w : src . getSecurityWrappers ( ) ) { info . addSecurityWrapper ( w ) ; } for ( HandlerWrapper w : src . getInitialHandlerChainWrappers ( ) ) { info . addInitialHandlerChainWrapper ( w ) ; } info . addSecurityRoles ( src . getSecurityRoles ( ) ) ; info . addNotificationReceivers ( src . getNotificationReceivers ( ) ) ; info . setAllowNonStandardWrappers ( src . isAllowNonStandardWrappers ( ) ) ; info . setDefaultSessionTimeout ( src . getDefaultSessionTimeout ( ) ) ; info . setServletContextAttributeBackingMap ( src . getServletContextAttributeBackingMap ( ) ) ; info . setServletSessionConfig ( src . getServletSessionConfig ( ) ) ; info . setHostName ( src . getHostName ( ) ) ; info . setDenyUncoveredHttpMethods ( src . isDenyUncoveredHttpMethods ( ) ) ; info . setServletStackTraces ( src . getServletStackTraces ( ) ) ; info . setInvalidateSessionOnLogout ( src . isInvalidateSessionOnLogout ( ) ) ; info . setDefaultCookieVersion ( src . getDefaultCookieVersion ( ) ) ; info . setSessionPersistenceManager ( src . getSessionPersistenceManager ( ) ) ; for ( Map . Entry < String , Set < String > > e : src . getPrincipalVersusRolesMap ( ) . entrySet ( ) ) { info . addPrincipalVsRoleMappings ( e . getKey ( ) , e . getValue ( ) ) ; } info . setIgnoreFlush ( src . isIgnoreFlush ( ) ) ; info . setAuthorizationManager ( src . getAuthorizationManager ( ) ) ; for ( Entry < String , AuthenticationMechanismFactory > e : src . getAuthenticationMechanisms ( ) . entrySet ( ) ) { info . addAuthenticationMechanism ( e . getKey ( ) , e . getValue ( ) ) ; } info . setJaspiAuthenticationMechanism ( src . getJaspiAuthenticationMechanism ( ) ) ; info . setSecurityContextFactory ( src . getSecurityContextFactory ( ) ) ; info . setServerName ( src . getServerName ( ) ) ; info . setMetricsCollector ( src . getMetricsCollector ( ) ) ; info . setSessionConfigWrapper ( src . getSessionConfigWrapper ( ) ) ; info . setEagerFilterInit ( src . isEagerFilterInit ( ) ) ; info . setDisableCachingForSecuredPages ( src . isDisableCachingForSecuredPages ( ) ) ; info . setExceptionHandler ( src . getExceptionHandler ( ) ) ; info . setEscapeErrorMessage ( src . isEscapeErrorMessage ( ) ) ; for ( SessionListener e : src . getSessionListeners ( ) ) { info . addSessionListener ( e ) ; } for ( LifecycleInterceptor e : src . getLifecycleInterceptors ( ) ) { info . addLifecycleInterceptor ( e ) ; } info . setAuthenticationMode ( src . getAuthenticationMode ( ) ) ; info . setDefaultMultipartConfig ( src . getDefaultMultipartConfig ( ) ) ; info . setContentTypeCacheSize ( src . getContentTypeCacheSize ( ) ) ; info . setSessionIdGenerator ( src . getSessionIdGenerator ( ) ) ; info . setSendCustomReasonPhraseOnError ( src . isSendCustomReasonPhraseOnError ( ) ) ; info . setChangeSessionIdOnLogin ( src . isChangeSessionIdOnLogin ( ) ) ; info . setCrawlerSessionManagerConfig ( src . getCrawlerSessionManagerConfig ( ) ) ; info . setSecurityDisabled ( src . isSecurityDisabled ( ) ) ; info . setUseCachedAuthenticationMechanism ( src . isUseCachedAuthenticationMechanism ( ) ) ; info . setCheckOtherSessionManagers ( src . isCheckOtherSessionManagers ( ) ) ; return info ; |
public class BigDecimal { /** * Expand the BIG _ TEN _ POWERS _ TABLE array to contain at least 10 * * n .
* @ param n the power of ten to be returned ( > = 0)
* @ return a { @ code BigDecimal } with the value ( 10 < sup > n < / sup > ) and
* in the meantime , the BIG _ TEN _ POWERS _ TABLE array gets
* expanded to the size greater than n . */
private static BigInteger expandBigIntegerTenPowers ( int n ) { } } | synchronized ( BigDecimal . class ) { BigInteger [ ] pows = BIG_TEN_POWERS_TABLE ; int curLen = pows . length ; // The following comparison and the above synchronized statement is
// to prevent multiple threads from expanding the same array .
if ( curLen <= n ) { int newLen = curLen << 1 ; while ( newLen <= n ) newLen <<= 1 ; pows = Arrays . copyOf ( pows , newLen ) ; for ( int i = curLen ; i < newLen ; i ++ ) pows [ i ] = pows [ i - 1 ] . multiply ( BigInteger . TEN ) ; // Based on the following facts :
// 1 . pows is a private local varible ;
// 2 . the following store is a volatile store .
// the newly created array elements can be safely published .
BIG_TEN_POWERS_TABLE = pows ; } return pows [ n ] ; } |
public class Job { /** * Get file info object
* @ param file file URI
* @ return file info object , { @ code null } if not found */
public FileInfo getFileInfo ( final URI file ) { } } | if ( file == null ) { return null ; } else if ( files . containsKey ( file ) ) { return files . get ( file ) ; } else if ( file . isAbsolute ( ) && file . toString ( ) . startsWith ( tempDirURI . toString ( ) ) ) { final URI relative = getRelativePath ( jobFile . toURI ( ) , file ) ; return files . get ( relative ) ; } else { return files . values ( ) . stream ( ) . filter ( fileInfo -> file . equals ( fileInfo . src ) || file . equals ( fileInfo . result ) ) . findFirst ( ) . orElse ( null ) ; } |
public class OcspUtils { /** * Returns the OCSP responder { @ link URI } or { @ code null } if it doesn ' t have one . */
public static URI ocspUri ( X509Certificate certificate ) throws IOException { } } | byte [ ] value = certificate . getExtensionValue ( Extension . authorityInfoAccess . getId ( ) ) ; if ( value == null ) { return null ; } ASN1Primitive authorityInfoAccess = X509ExtensionUtil . fromExtensionValue ( value ) ; if ( ! ( authorityInfoAccess instanceof DLSequence ) ) { return null ; } DLSequence aiaSequence = ( DLSequence ) authorityInfoAccess ; DERTaggedObject taggedObject = findObject ( aiaSequence , OCSP_RESPONDER_OID , DERTaggedObject . class ) ; if ( taggedObject == null ) { return null ; } if ( taggedObject . getTagNo ( ) != BERTags . OBJECT_IDENTIFIER ) { return null ; } byte [ ] encoded = taggedObject . getEncoded ( ) ; int length = ( int ) encoded [ 1 ] & 0xFF ; String uri = new String ( encoded , 2 , length , CharsetUtil . UTF_8 ) ; return URI . create ( uri ) ; |
public class ProjectCalendar { /** * Utility method to retrieve the next working date start time , given
* a date and time as a starting point .
* @ param date date and time start point
* @ return date and time of next work start */
public Date getNextWorkStart ( Date date ) { } } | Calendar cal = Calendar . getInstance ( ) ; cal . setTime ( date ) ; updateToNextWorkStart ( cal ) ; return cal . getTime ( ) ; |
public class OpensslNameUtilities { /** * Formats principal in the ugly , extremely non - standard and widely hated
* OpenSSL , slash - separated format ( which everyone on the Grid uses , btw . . . ) .
* @ param principal
* the principal for which the DN should be serialized
* @ return a string representing the principal in the terrible OpenSSL
* slash - separated format */
public static final String getOpensslSubjectString ( X500Principal principal ) { } } | String rfcReadableString = X500NameUtils . getReadableForm ( principal ) ; return OpensslNameUtils . convertFromRfc2253 ( rfcReadableString , false ) ; |
public class ApiClient { /** * Parse date or date time in string format into Date object .
* @ param str Date time string to be parsed
* @ return Date representation of the string */
public Date parseDateOrDatetime ( String str ) { } } | if ( str == null ) return null ; else if ( str . length ( ) <= dateLength ) return parseDate ( str ) ; else return parseDatetime ( str ) ; |
public class TimestampFormat { /** * This method returns the default pattern modified to add millisecond
* after the seconds .
* @ param locale a locale
* @ return a pattern string */
static String defaultPattern ( Locale locale ) { } } | return ( ( SimpleDateFormat ) DateFormat . getDateTimeInstance ( DateFormat . SHORT , DateFormat . MEDIUM , locale ) ) . toPattern ( ) . replace ( "ss" , "ss.SSS" ) ; |
public class Agg { /** * Get a { @ link Collector } that calculates the < code > MEDIAN ( ) < / code > function given a specific ordering . */
public static < T , U > Collector < T , ? , Optional < U > > median ( Function < ? super T , ? extends U > function , Comparator < ? super U > comparator ) { } } | return percentile ( 0.5 , function , comparator ) ; |
public class ImageServletResponseImpl { /** * Writes the image to the original { @ code ServletOutputStream } .
* If no format is set in this response , the image is encoded in the same
* format as the original image .
* @ throws IOException if an I / O exception occurs during writing */
public void flush ( ) throws IOException { } } | String outputType = getOutputContentType ( ) ; // Force transcoding , if no other filtering is done
if ( outputType != null && ! outputType . equals ( originalContentType ) ) { getImage ( ) ; } if ( image != null ) { Iterator writers = ImageIO . getImageWritersByMIMEType ( outputType ) ; if ( writers . hasNext ( ) ) { super . setContentType ( outputType ) ; OutputStream out = super . getOutputStream ( ) ; try { ImageWriter writer = ( ImageWriter ) writers . next ( ) ; try { ImageWriteParam param = writer . getDefaultWriteParam ( ) ; // POST - PROCESS
// For known formats that don ' t support transparency , convert to opaque
if ( isNonAlphaFormat ( outputType ) && image . getColorModel ( ) . getTransparency ( ) != Transparency . OPAQUE ) { image = ImageUtil . toBuffered ( image , BufferedImage . TYPE_INT_RGB ) ; } Float requestQuality = ( Float ) originalRequest . getAttribute ( ImageServletResponse . ATTRIB_OUTPUT_QUALITY ) ; // The default JPEG quality is not good enough , so always adjust compression / quality
if ( ( requestQuality != null || "jpeg" . equalsIgnoreCase ( getFormatNameSafe ( writer ) ) ) && param . canWriteCompressed ( ) ) { // TODO : See http : / / blog . apokalyptik . com / 2009/09/16 / quality - time - with - your - jpegs / for better adjusting the ( default ) JPEG quality
// OR : Use the metadata of the original image
param . setCompressionMode ( ImageWriteParam . MODE_EXPLICIT ) ; // WORKAROUND : Known bug in GIFImageWriter in certain JDK versions , compression type is not set by default
if ( param . getCompressionTypes ( ) != null && param . getCompressionType ( ) == null ) { param . setCompressionType ( param . getCompressionTypes ( ) [ 0 ] ) ; // Just choose any , to keep param happy
} param . setCompressionQuality ( requestQuality != null ? requestQuality : 0.8f ) ; } if ( "gif" . equalsIgnoreCase ( getFormatNameSafe ( writer ) ) && ! ( image . getColorModel ( ) instanceof IndexColorModel ) /* & & image . getColorModel ( ) . getTransparency ( ) ! = Transparency . OPAQUE */
) { // WORKAROUND : Bug in GIFImageWriter may throw NPE if transparent pixels
// See : http : / / bugs . sun . com / view _ bug . do ? bug _ id = 6287936
image = ImageUtil . createIndexed ( ImageUtil . toBuffered ( image ) , 256 , null , ( image . getColorModel ( ) . getTransparency ( ) == Transparency . OPAQUE ? ImageUtil . TRANSPARENCY_OPAQUE : ImageUtil . TRANSPARENCY_BITMASK ) | ImageUtil . DITHER_DIFFUSION_ALTSCANS ) ; } ImageOutputStream stream = ImageIO . createImageOutputStream ( out ) ; writer . setOutput ( stream ) ; try { writer . write ( null , new IIOImage ( image , null , null ) , param ) ; } finally { stream . close ( ) ; } } finally { writer . dispose ( ) ; } } finally { out . flush ( ) ; } } else { context . log ( "ERROR: No writer for content-type: " + outputType ) ; throw new IIOException ( "Unable to transcode image: No suitable image writer found (content-type: " + outputType + ")." ) ; } } else { super . setContentType ( originalContentType ) ; ServletOutputStream out = super . getOutputStream ( ) ; try { if ( bufferedOut != null ) { bufferedOut . writeTo ( out ) ; } } finally { out . flush ( ) ; } } |
public class AbstractFFmpegStreamBuilder { /** * Decodes but discards input until the offset .
* @ param offset The offset
* @ param units The units the offset is in
* @ return this */
public T setStartOffset ( long offset , TimeUnit units ) { } } | checkNotNull ( units ) ; this . startOffset = units . toMillis ( offset ) ; return getThis ( ) ; |
public class TimelinePublisher { /** * Publish the { @ link SymbolicTimeline } s . This method renders in a background thread ( unless blocking behavior
* is requested through parameter < code > block < / code > ) .
* @ param block Set to < code > true < / code > if the call should block until { @ link SymbolicTimeline } s are rendered .
* @ param skip Set to < code > true < / code > if this call should be skipped in case previous rendering is still in progress . */
public void publish ( boolean block , boolean skip ) { } } | // Sort components so we always get the same timline order . . .
// Arrays . sort ( components ) ;
// If blocking behavior has been requested , wait until any previous call
// to the image encoding thread has finished . The rest of the
// code in this function is written from an " encode if possible " perspective .
if ( ! skip ) imageEncoder . waitUntilFinished ( ) ; if ( ! imageEncoder . isWorking ( ) ) { timelinesToRefresh . clear ( ) ; if ( bounds != null ) { min = bounds . min + origin ; max = bounds . max + origin ; } else { min = origin ; max = Long . MIN_VALUE ; } for ( int tl = 0 ; tl < components . length ; tl ++ ) { String comp = components [ tl ] ; SymbolicTimeline stl = null ; // synchronized ( ans ) {
synchronized ( an ) { // stl = new SymbolicTimeline ( ans , comp ) ;
if ( markingsToExclude != null ) stl = new SymbolicTimeline ( an , comp , markingsToExclude ) ; else stl = new SymbolicTimeline ( an , comp ) ; } if ( bounds == null ) { if ( stl . getPulses ( ) [ stl . getPulses ( ) . length - 1 ] > max ) max = stl . getPulses ( ) [ stl . getPulses ( ) . length - 1 ] ; } timelinesToRefresh . add ( stl ) ; } long delta = 0 ; double portionBefore = 0.9 ; if ( slidingWindow && bounds != null ) { delta = bounds . max - bounds . min ; if ( ( ( double ) timeNow ) / temporalResolution > origin + ( ( double ) delta ) * portionBefore ) { min = ( long ) ( ( ( double ) timeNow ) / ( double ) temporalResolution - ( ( double ) delta ) * portionBefore ) ; max = ( long ) ( ( ( double ) timeNow ) / ( double ) temporalResolution + ( ( double ) delta ) * ( 1 - portionBefore ) ) ; } } imageEncoder . encodeTimelines ( timelinesToRefresh ) ; logger . finest ( "Image being rendered..." ) ; } else { logger . finest ( "Skipped rendering image." ) ; } // If blocking behavior has been requested , do not return until
// the image encoding thread has finished .
if ( block ) imageEncoder . waitUntilFinished ( ) ; |
public class PropDefConceptId { /** * Returns a concept propId with the given proposition propId and property name .
* @ param propId a proposition propId { @ link String } . Cannot be
* < code > null < / code > .
* @ param propertyName a property name { @ link String } .
* @ return a { @ link PropDefConceptId } . */
public static ConceptId getInstance ( String propId , String propertyName , Metadata metadata ) { } } | return getInstance ( propId , propertyName , null , metadata ) ; |
public class DomConfigurationWriter { /** * Gets the XML element that represents the string patterns
* @ return */
public Element getStringPatternsElement ( ) { } } | final Element referenceDataCatalogElement = getReferenceDataCatalogElement ( ) ; final Element stringPatternsElement = getOrCreateChildElementByTagName ( referenceDataCatalogElement , "string-patterns" ) ; if ( stringPatternsElement == null ) { throw new IllegalStateException ( "Could not find <string-patterns> element in configuration file" ) ; } return stringPatternsElement ; |
public class ResourceFactory { /** * Creates a resources from the supplied asset
* @ param ass The asset to create the resource from .
* @ param userId user id to log on to massive with
* @ param password password to log on to massive with
* @ param apiKey the apikey for the marketplace
* @ return
* @ throws RepositoryBackendException */
public RepositoryResourceImpl createResourceFromAsset ( Asset ass , RepositoryConnection connection ) throws RepositoryBackendException { } } | // No wlp information means no type set , so can ' t create a resource from this . . . .
RepositoryResourceImpl result ; if ( null == ass . getWlpInformation ( ) || ass . getType ( ) == null ) { result = new RepositoryResourceImpl ( connection , ass ) { } ; } else { result = createResource ( ass . getType ( ) , connection , ass ) ; } result . parseAttachmentsInAsset ( ) ; return result ; |
public class Peer { /** * Set class to handle peer eventing service disconnects
* @ param newPeerEventingServiceDisconnectedHandler New handler to replace . If set to null no retry will take place .
* @ return the old handler . */
public PeerEventingServiceDisconnected setPeerEventingServiceDisconnected ( PeerEventingServiceDisconnected newPeerEventingServiceDisconnectedHandler ) { } } | PeerEventingServiceDisconnected ret = disconnectedHandler ; disconnectedHandler = newPeerEventingServiceDisconnectedHandler ; return ret ; |
public class XMLSerializer { /** * Write boolean attribute .
* @ param prefix the prefix
* @ param namespaceURI the namespace URI
* @ param localName the local name
* @ param value the value
* @ throws Exception the exception */
public void writeBooleanAttribute ( String prefix , String namespaceURI , String localName , boolean value ) throws Exception { } } | this . attribute ( namespaceURI , localName , Boolean . toString ( value ) ) ; |
public class MethodBuilder { /** * Add proxy method that exposes whether remote is alive */
private void addProxyRemoteAlive ( TypeSpec . Builder classBuilder ) { } } | MethodSpec . Builder methodBuilder = MethodSpec . methodBuilder ( "isRemoteAlive" ) . addModifiers ( Modifier . PUBLIC ) . returns ( boolean . class ) . addStatement ( "boolean alive = false" ) . beginControlFlow ( "try" ) . addStatement ( "alive = mRemote.isBinderAlive()" ) . endControlFlow ( ) . beginControlFlow ( "catch ($T ignored)" , Exception . class ) . endControlFlow ( ) . addStatement ( "return alive" ) . addJavadoc ( "Checks whether the remote process is alive\n" ) ; classBuilder . addMethod ( methodBuilder . build ( ) ) ; |
public class JobFileTableMapper { /** * looks for cost file in distributed cache
* @ param cachePath of the cost properties file
* @ param machineType of the node the job ran on
* @ throws IOException */
Properties loadCostProperties ( Path cachePath , String machineType ) { } } | Properties prop = new Properties ( ) ; InputStream inp = null ; try { inp = new FileInputStream ( cachePath . toString ( ) ) ; prop . load ( inp ) ; return prop ; } catch ( FileNotFoundException fnf ) { LOG . error ( "cost properties does not exist, using default values" ) ; return null ; } catch ( IOException e ) { LOG . error ( "error loading properties, using default values" ) ; return null ; } finally { if ( inp != null ) { try { inp . close ( ) ; } catch ( IOException ignore ) { // do nothing
} } } |
public class MalisisRegistry { /** * Registers a new { @ link SoundEvent } .
* @ param modId the mod id
* @ param soundId the sound id
* @ return the sound event */
public static SoundEvent registerSound ( String modId , String soundId ) { } } | ResourceLocation rl = new ResourceLocation ( modId , soundId ) ; SoundEvent sound = new SoundEvent ( rl ) ; sound . setRegistryName ( rl ) ; ForgeRegistries . SOUND_EVENTS . register ( sound ) ; return sound ; |
public class TuneBook { /** * Returns the reference numbers of tunes contained in this tunebook .
* @ return An array containing the reference numbers of tunes contained in
* this tunebook , ordered in the way they were added in this
* tunebook . */
public int [ ] getReferenceNumbers ( ) { } } | Iterator it = m_tunes . keySet ( ) . iterator ( ) ; int [ ] refNb = new int [ m_tunes . size ( ) ] ; int index = 0 ; while ( it . hasNext ( ) ) { refNb [ index ] = ( Integer ) it . next ( ) ; index ++ ; } return refNb ; |
public class TrainingsImpl { /** * Get information about a specific tag .
* @ param projectId The project this tag belongs to
* @ param tagId The tag id
* @ param getTagOptionalParameter the object representing the optional parameters to be set before calling this API
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the Tag object */
public Observable < Tag > getTagAsync ( UUID projectId , UUID tagId , GetTagOptionalParameter getTagOptionalParameter ) { } } | return getTagWithServiceResponseAsync ( projectId , tagId , getTagOptionalParameter ) . map ( new Func1 < ServiceResponse < Tag > , Tag > ( ) { @ Override public Tag call ( ServiceResponse < Tag > response ) { return response . body ( ) ; } } ) ; |
public class MListTable { /** * { @ inheritDoc } */
@ Override public void setModel ( final TableModel tableModel ) { } } | if ( ! ( tableModel instanceof MListTableModel ) ) { throw new IllegalArgumentException ( "model doit être instance de " + MListTableModel . class . getName ( ) ) ; } super . setModel ( tableModel ) ; |
public class UIInput { /** * Store the specified object as the " local value " of this component . The value - binding named " value " ( if any ) is
* ignored ; the object is only stored locally on this component . During the " update model " phase , if there is a
* value - binding named " value " then this local value will be stored via that value - binding and the " local value "
* reset to null . */
@ Override public void setValue ( Object value ) { } } | FacesContext facesContext = getFacesContext ( ) ; if ( facesContext != null && facesContext . isProjectStage ( ProjectStage . Development ) ) { // extended debug - info when in Development mode
_createFieldDebugInfo ( facesContext , "localValue" , getLocalValue ( ) , value , 1 ) ; } setLocalValueSet ( true ) ; super . setValue ( value ) ; |
public class PersistentExecutorMBeanImpl { /** * Builds a new client appropriate exception to replace the caught exception . This tells the
* client to look in the logs for further information .
* < br >
* Logs the information from the original exception .
* @ param e internal exception which is caught
* @ return new client - appropriate exception
* @ throws Exception */
private Exception buildAndLogException ( Exception e ) throws Exception { } } | PartitionRecord pr = new PartitionRecord ( false ) ; pr . setExecutor ( _pe . name ) ; List < PartitionRecord > records = _pe . taskStore . find ( pr ) ; PartitionRecord record = records . get ( 0 ) ; String id = "PersistentExecutorMBean-" . concat ( String . valueOf ( exceptionCounter . getAndIncrement ( ) ) ) ; String logDir = record . getUserDir ( ) . concat ( "servers/" ) . concat ( record . getLibertyServer ( ) ) . concat ( "/logs/" ) ; Exception ex = new Exception ( MBeanMessageHelper . getUnableToPerformOperationMessage ( record . getLibertyServer ( ) , record . getHostName ( ) , logDir . replace ( '/' , File . separatorChar ) , id ) ) ; Object [ ] serverStrings = { id , Utils . stackTraceToString ( e ) } ; Tr . error ( tc , "CWWKC1559.mbean.operation.failure" , serverStrings ) ; return ex ; |
public class AbstractFunction { /** * Creates an AVG ( expr ) function expression that returns the average of all the number values
* in the group of the values expressed by the given expression .
* @ param expression The expression .
* @ return The AVG ( expr ) function . */
@ NonNull public static Expression avg ( @ NonNull Expression expression ) { } } | if ( expression == null ) { throw new IllegalArgumentException ( "expression cannot be null." ) ; } return new Expression . FunctionExpression ( "AVG()" , Arrays . asList ( expression ) ) ; |
public class ParseUtils { /** * Assuming that idx points to the beginning of a CQL value in toParse , returns the index of the
* first character after this value .
* @ param toParse the string to skip a value form .
* @ param idx the index to start parsing a value from .
* @ return the index ending the CQL value starting at { @ code idx } .
* @ throws IllegalArgumentException if idx doesn ' t point to the start of a valid CQL value . */
public static int skipCQLValue ( String toParse , int idx ) { } } | if ( idx >= toParse . length ( ) ) throw new IllegalArgumentException ( ) ; if ( isBlank ( toParse . charAt ( idx ) ) ) throw new IllegalArgumentException ( ) ; int cbrackets = 0 ; int sbrackets = 0 ; int parens = 0 ; boolean inString = false ; do { char c = toParse . charAt ( idx ) ; if ( inString ) { if ( c == '\'' ) { if ( idx + 1 < toParse . length ( ) && toParse . charAt ( idx + 1 ) == '\'' ) { ++ idx ; // this is an escaped quote , skip it
} else { inString = false ; if ( cbrackets == 0 && sbrackets == 0 && parens == 0 ) return idx + 1 ; } } // Skip any other character
} else if ( c == '\'' ) { inString = true ; } else if ( c == '{' ) { ++ cbrackets ; } else if ( c == '[' ) { ++ sbrackets ; } else if ( c == '(' ) { ++ parens ; } else if ( c == '}' ) { if ( cbrackets == 0 ) return idx ; -- cbrackets ; if ( cbrackets == 0 && sbrackets == 0 && parens == 0 ) return idx + 1 ; } else if ( c == ']' ) { if ( sbrackets == 0 ) return idx ; -- sbrackets ; if ( cbrackets == 0 && sbrackets == 0 && parens == 0 ) return idx + 1 ; } else if ( c == ')' ) { if ( parens == 0 ) return idx ; -- parens ; if ( cbrackets == 0 && sbrackets == 0 && parens == 0 ) return idx + 1 ; } else if ( isBlank ( c ) || ! isCqlIdentifierChar ( c ) ) { if ( cbrackets == 0 && sbrackets == 0 && parens == 0 ) return idx ; } } while ( ++ idx < toParse . length ( ) ) ; if ( inString || cbrackets != 0 || sbrackets != 0 || parens != 0 ) throw new IllegalArgumentException ( ) ; return idx ; |
public class DefaultGroovyMethods { /** * Convert an Iterable to a List . The Iterable ' s iterator will
* become exhausted of elements after making this conversion .
* Example usage :
* < pre class = " groovyTestCase " > def x = [ 1,2,3 ] as HashSet
* assert x . class = = HashSet
* assert x . toList ( ) instanceof List < / pre >
* @ param self an Iterable
* @ return a List
* @ since 1.8.7 */
public static < T > List < T > toList ( Iterable < T > self ) { } } | return toList ( self . iterator ( ) ) ; |
public class ServiceEventAdapter { /** * Receive notification of a service lifecycle change event and adapt it to
* the format required for the < code > EventAdmin < / code > service .
* @ param serviceEvent
* the service lifecycle event to publish as an < code > Event < / code > */
@ Override public void serviceChanged ( ServiceEvent serviceEvent ) { } } | final String topic = getTopic ( serviceEvent ) ; // Bail quickly if the event is one that should be ignored
if ( topic == null ) { return ; } // Event properties
Map < String , Object > eventProperties = new HashMap < String , Object > ( ) ; // " event " - - > the original event object
eventProperties . put ( EventConstants . EVENT , serviceEvent ) ; // " service " - - > result of getServiceReference
// " service . id " - - > the service ' s ID
// " service . pid " - - > the service ' s persistent ID if not null
// " service . objectClass " - - > the services object class
ServiceReference serviceReference = serviceEvent . getServiceReference ( ) ; if ( serviceReference != null ) { eventProperties . put ( EventConstants . SERVICE , serviceReference ) ; Long serviceId = ( Long ) serviceReference . getProperty ( Constants . SERVICE_ID ) ; eventProperties . put ( EventConstants . SERVICE_ID , serviceId ) ; Object servicePersistentId = serviceReference . getProperty ( Constants . SERVICE_PID ) ; if ( servicePersistentId != null ) { // String [ ] must be coerced into Collection < String >
if ( servicePersistentId instanceof String [ ] ) { servicePersistentId = Arrays . asList ( ( String [ ] ) servicePersistentId ) ; } eventProperties . put ( EventConstants . SERVICE_PID , servicePersistentId ) ; } String [ ] objectClass = ( String [ ] ) serviceReference . getProperty ( Constants . OBJECTCLASS ) ; if ( objectClass != null ) { eventProperties . put ( EventConstants . SERVICE_OBJECTCLASS , objectClass ) ; } } // Construct and fire the event
Event event = new Event ( topic , eventProperties ) ; eventAdmin . postEvent ( event ) ; |
public class CeylonRepoLayout { /** * The Aether implementation .
* @ param artifact The artifact to get the path for
* @ return URI of the artifact
* @ see org . eclipse . aether . util . repository . layout . RepositoryLayout # getPath ( org . eclipse . aether . artifact . Artifact ) */
public URI getPath ( final org . eclipse . aether . artifact . Artifact artifact ) { } } | return toUri ( pathOf ( new DefaultArtifact ( artifact . getGroupId ( ) , artifact . getArtifactId ( ) , artifact . getBaseVersion ( ) , "" , artifact . getExtension ( ) , artifact . getClassifier ( ) , new DefaultArtifactHandler ( artifact . getExtension ( ) ) ) ) ) ; |
public class CompilerUtils { /** * Get a Class . forName - able string for the given type signature . */
public static String getFormClassName ( TypeDeclaration jclass , CoreAnnotationProcessorEnv env ) { } } | if ( isAssignableFrom ( STRUTS_FORM_CLASS_NAME , jclass , env ) ) { return getLoadableName ( jclass ) ; } else if ( isAssignableFrom ( BEA_XMLOBJECT_CLASS_NAME , jclass , env ) ) { return XML_FORM_CLASS_NAME ; } else if ( isAssignableFrom ( APACHE_XMLOBJECT_CLASS_NAME , jclass , env ) ) { return XML_FORM_CLASS_NAME ; } else { return ANY_FORM_CLASS_NAME ; } |
public class CommerceOrderNoteUtil { /** * Returns a range of all the commerce order notes where commerceOrderId = & # 63 ; .
* Useful when paginating results . Returns a maximum of < code > end - start < / code > instances . < code > start < / code > and < code > end < / code > are not primary keys , they are indexes in the result set . Thus , < code > 0 < / code > refers to the first result in the set . Setting both < code > start < / code > and < code > end < / code > to { @ link QueryUtil # ALL _ POS } will return the full result set . If < code > orderByComparator < / code > is specified , then the query will include the given ORDER BY logic . If < code > orderByComparator < / code > is absent and pagination is required ( < code > start < / code > and < code > end < / code > are not { @ link QueryUtil # ALL _ POS } ) , then the query will include the default ORDER BY logic from { @ link CommerceOrderNoteModelImpl } . If both < code > orderByComparator < / code > and pagination are absent , for performance reasons , the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order .
* @ param commerceOrderId the commerce order ID
* @ param start the lower bound of the range of commerce order notes
* @ param end the upper bound of the range of commerce order notes ( not inclusive )
* @ return the range of matching commerce order notes */
public static List < CommerceOrderNote > findByCommerceOrderId ( long commerceOrderId , int start , int end ) { } } | return getPersistence ( ) . findByCommerceOrderId ( commerceOrderId , start , end ) ; |
public class RestServiceAdapter { /** * The method overrides the one from the super class and does the following :
* < ul >
* < li > For HTTP GET and DELETE requests , it returns an empty string < / li >
* < li > Otherwise it gets the value of the variable with the name specified in the
* attribute REQUEST _ VARIABLE . The value is typically an XML document or a string < / li >
* < li > It invokes the variable translator to convert the value into a string
* and then returns the string value . < / li >
* < / ul >
* For HTTP methods other than GET and DELETE this will throw an exception if the
* request data variable is not bound , or the value is not a DocumentReference or String . */
@ Override protected String getRequestData ( ) throws ActivityException { } } | String httpMethod = getHttpMethod ( ) ; if ( httpMethod . equals ( "GET" ) || httpMethod . equals ( "DELETE" ) ) return "" ; String request = super . getRequestData ( ) ; if ( request == null ) throw new ActivityException ( "Request data attribute is missing for HTTP method: " + httpMethod ) ; return request ; |
public class ListDeploymentConfigsResult { /** * A list of deployment configurations , including built - in configurations such as CodeDeployDefault . OneAtATime .
* @ param deploymentConfigsList
* A list of deployment configurations , including built - in configurations such as
* CodeDeployDefault . OneAtATime . */
public void setDeploymentConfigsList ( java . util . Collection < String > deploymentConfigsList ) { } } | if ( deploymentConfigsList == null ) { this . deploymentConfigsList = null ; return ; } this . deploymentConfigsList = new com . amazonaws . internal . SdkInternalList < String > ( deploymentConfigsList ) ; |
public class CmsProjectDriver { /** * Returns the projects of a given resource . < p >
* @ param dbc the database context
* @ param rootPath the resource root path
* @ return the projects of the resource , as a list of projects
* @ throws CmsDataAccessException if something goes wrong */
public List < CmsProject > readProjectsForResource ( CmsDbContext dbc , String rootPath ) throws CmsDataAccessException { } } | PreparedStatement stmt = null ; List < CmsProject > projects = new ArrayList < CmsProject > ( ) ; ResultSet res = null ; Connection conn = null ; try { conn = m_sqlManager . getConnection ( dbc ) ; stmt = m_sqlManager . getPreparedStatement ( conn , "C_PROJECTS_READ_BYRESOURCE_1" ) ; stmt . setString ( 1 , rootPath + "%" ) ; res = stmt . executeQuery ( ) ; if ( res . next ( ) ) { projects . add ( internalCreateProject ( res ) ) ; while ( res . next ( ) ) { // do nothing only move through all rows because of mssql odbc driver
} } } catch ( SQLException e ) { throw new CmsDbSqlException ( Messages . get ( ) . container ( Messages . ERR_GENERIC_SQL_1 , CmsDbSqlException . getErrorQuery ( stmt ) ) , e ) ; } finally { m_sqlManager . closeAll ( dbc , conn , stmt , res ) ; } return projects ; |
public class LoadStatistics { /** * Generates the load statistics graph . */
public TrendChart doGraph ( @ QueryParameter String type ) throws IOException { } } | return createTrendChart ( TimeScale . parse ( type ) ) ; |
public class AbstractEJBRuntime { /** * Creates the reference context for this EJB . */
protected ReferenceContext createReferenceContext ( BeanMetaData bmd ) // F743-29417
{ } } | final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "createReferenceContext: " + bmd . j2eeName ) ; if ( bmd . ivReferenceContext == null ) { bmd . ivReferenceContext = getInjectionEngine ( ) . createReferenceContext ( ) ; bmd . ivReferenceContext . add ( new ComponentNameSpaceConfigurationProviderImpl ( bmd , this ) ) ; // F85115
} if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "createReferenceContext" , bmd . ivReferenceContext ) ; return bmd . ivReferenceContext ; |
public class DublinCoreSchema { /** * Adds a title .
* @ param title */
public void addTitle ( String title ) { } } | XmpArray array = new XmpArray ( XmpArray . ALTERNATIVE ) ; array . add ( title ) ; setProperty ( TITLE , array ) ; |
public class Transformations { /** * Creates a LiveData , let ' s name it { @ code swLiveData } , which follows next flow :
* it reacts on changes of { @ code trigger } LiveData , applies the given function to new value of
* { @ code trigger } LiveData and sets resulting LiveData as a " backing " LiveData
* to { @ code swLiveData } .
* " Backing " LiveData means , that all events emitted by it will retransmitted
* by { @ code swLiveData } .
* If the given function returns null , then { @ code swLiveData } is not " backed " by any other
* LiveData .
* The given function { @ code func } will be executed on the main thread .
* Consider the case where you have a LiveData containing a user id . Every time there ' s a new
* user id emitted , you want to trigger a request to get the user object corresponding to that
* id , from a repository that also returns a LiveData .
* The { @ code userIdLiveData } is the trigger and the LiveData returned by the { @ code
* repository . getUserById } is the " backing " LiveData .
* In a scenario where the repository contains User ( 1 , " Jane " ) and User ( 2 , " John " ) , when the
* userIdLiveData value is set to " 1 " , the { @ code switchMap } will call { @ code getUser ( 1 ) } ,
* that will return a LiveData containing the value User ( 1 , " Jane " ) . So now , the userLiveData
* will emit User ( 1 , " Jane " ) . When the user in the repository gets updated to User ( 1 , " Sarah " ) ,
* the { @ code userLiveData } gets automatically notified and will emit User ( 1 , " Sarah " ) .
* When the { @ code setUserId } method is called with userId = " 2 " , the value of the { @ code
* userIdLiveData } changes and automatically triggers a request for getting the user with id
* " 2 " from the repository . So , the { @ code userLiveData } emits User ( 2 , " John " ) . The LiveData
* returned by { @ code repository . getUserById ( 1 ) } is removed as a source .
* < pre >
* MutableLiveData & lt ; String & gt ; userIdLiveData = . . . ;
* LiveData & lt ; User & gt ; userLiveData = Transformations . switchMap ( userIdLiveData , id - & gt ;
* repository . getUserById ( id ) ) ;
* void setUserId ( String userId ) {
* this . userIdLiveData . setValue ( userId ) ;
* < / pre >
* @ param < X > a type of { @ code source } LiveData
* @ param < Y > a type of resulting LiveData
* @ param trigger a { @ code LiveData } to listen to
* @ param func a function which creates " backing " LiveData
* @ return the live data */
@ MainThread public static < X , Y > LiveData < Y > switchMap ( @ NonNull LiveData < X > trigger , @ NonNull final Function < X , LiveData < Y > > func ) { } } | final MediatorLiveData < Y > result = new MediatorLiveData < > ( ) ; result . addSource ( trigger , new Observer < X > ( ) { LiveData < Y > mSource ; @ Override public void onChanged ( @ Nullable X x ) { LiveData < Y > newLiveData = func . apply ( x ) ; if ( mSource == newLiveData ) { return ; } if ( mSource != null ) { result . removeSource ( mSource ) ; } mSource = newLiveData ; if ( mSource != null ) { result . addSource ( mSource , new Observer < Y > ( ) { @ Override public void onChanged ( @ Nullable Y y ) { result . setValue ( y ) ; } } ) ; } } } ) ; return result ; |
public class UdpServer { /** * The host to which this server should bind .
* @ param host The host to bind to .
* @ return a new { @ link UdpServer } */
public final UdpServer host ( String host ) { } } | Objects . requireNonNull ( host , "host" ) ; return bootstrap ( b -> b . localAddress ( host , getPort ( b ) ) ) ; |
public class FSDirectory { /** * Get a listing of files given path ' src '
* This function is admittedly very inefficient right now . We ' ll
* make it better later . */
HdfsFileStatus [ ] getHdfsListing ( String src ) { } } | // prepare components outside of readLock
String srcs = normalizePath ( src ) ; byte [ ] [ ] components = INodeDirectory . getPathComponents ( srcs ) ; readLock ( ) ; try { INode targetNode = rootDir . getNode ( components ) ; if ( targetNode == null ) return null ; if ( ! targetNode . isDirectory ( ) ) { return new HdfsFileStatus [ ] { createHdfsFileStatus ( HdfsFileStatus . EMPTY_NAME , targetNode ) } ; } List < INode > contents = ( ( INodeDirectory ) targetNode ) . getChildren ( ) ; HdfsFileStatus listing [ ] = new HdfsFileStatus [ contents . size ( ) ] ; int i = 0 ; for ( INode cur : contents ) { listing [ i ] = createHdfsFileStatus ( cur . name , cur ) ; i ++ ; } return listing ; } finally { readUnlock ( ) ; } |
public class ExitCodeGenerators { /** * Get the final exit code that should be returned based on all contained generators .
* @ return the final exit code . */
public int getExitCode ( ) { } } | int exitCode = 0 ; for ( ExitCodeGenerator generator : this . generators ) { try { int value = generator . getExitCode ( ) ; if ( value > 0 && value > exitCode || value < 0 && value < exitCode ) { exitCode = value ; } } catch ( Exception ex ) { exitCode = ( exitCode != 0 ) ? exitCode : 1 ; ex . printStackTrace ( ) ; } } return exitCode ; |
public class ClientBroadcastStream { /** * Sends publish start notifications */
private void sendPublishStartNotify ( ) { } } | Status publishStatus = new Status ( StatusCodes . NS_PUBLISH_START ) ; publishStatus . setClientid ( getStreamId ( ) ) ; publishStatus . setDetails ( getPublishedName ( ) ) ; StatusMessage startMsg = new StatusMessage ( ) ; startMsg . setBody ( publishStatus ) ; pushMessage ( startMsg ) ; setState ( StreamState . PUBLISHING ) ; |
public class RangeVariable { /** * Returns the index for the column given the column ' s table name
* and column name . If the table name is null , there is no table
* name specified . For example , in a query " select C from T " there
* is no table name , so tableName would be null . In the query
* " select T . C from T " tableName would be the string " T " . Don ' t
* return any column found in a USING join condition .
* @ param tableName
* @ param columnName
* @ return the column index or - 1 if the column name is in a using list . */
public int findColumn ( String tableName , String columnName ) { } } | // The namedJoinColumnExpressions are ExpressionColumn objects
// for columns named in USING conditions . Each range variable
// has a possibly empty list of these . If two range variables are
// operands of a join with a USING condition , both get the same list
// of USING columns . In our semantics the query
// select T2 . C from T1 join T2 using ( C ) ;
// selects T2 . C . This is not standard behavior , but it seems to
// be common to mysql and postgresql . The query
// select C from T1 join T2 using ( C ) ;
// selects the C from T1 or T2 , since the using clause says
// they will have the same value . In the query
// select C from T1 join T2 using ( C ) , T3;
// where T3 has a column named C , there is an ambiguity , since
// the first join tree ( T1 join T2 using ( C ) ) has a column named C and
// T3 has another C column . In this case we need the T1 . C notation .
// The query
// select T1 . C from T1 join T2 using ( C ) , T3;
// will select the C from the first join tree , and
// select T3 . C from T1 join T2 using ( C ) , T3;
// will select the C from the second join tree , which is just T3.
// If we don ' t have a table name and there are some USING columns ,
// then look into them . If the name is in the USING columns , it
// is not in this range variable . The function getColumnExpression
// will fetch this using variable in another search .
if ( namedJoinColumnExpressions != null && tableName == null && namedJoinColumnExpressions . containsKey ( columnName ) ) { return - 1 ; } if ( variables != null ) { return variables . getIndex ( columnName ) ; } else if ( columnAliases != null ) { return columnAliases . getIndex ( columnName ) ; } else { return rangeTable . findColumn ( columnName ) ; } |
public class Record { /** * Refresh this record to the current data .
* @ param iChangeType Optional change type if a message was received saying this changed .
* @ param bWarningIfChanged If anything has changed in this record , return a RECORD _ CHANGED warning .
* @ return error */
public int refreshToCurrent ( int iChangeType , boolean bWarningIfChanged ) { } } | int iErrorCode = DBConstants . NORMAL_RETURN ; try { int iHandleType = DBConstants . BOOKMARK_HANDLE ; if ( ( this . getEditMode ( ) == Constants . EDIT_CURRENT ) || ( this . getEditMode ( ) == Constants . EDIT_IN_PROGRESS ) ) { Object bookmark = this . getHandle ( iHandleType ) ; if ( bookmark != null ) { Object [ ] rgobjEnabledFields = this . setEnableFieldListeners ( false ) ; boolean [ ] rgbEnabled = this . setEnableListeners ( false ) ; int iOldOpenMode = this . getOpenMode ( ) ; this . setOpenMode ( DBConstants . OPEN_DONT_CHANGE_CURRENT_LOCK_TYPE | ( iOldOpenMode & DBConstants . LOCK_TYPE_MASK ) ) ; // Straight read - no cache ( keep lock settings )
// First step - backup the current data
int iFieldsTypes = BaseBuffer . ALL_FIELDS ; BaseBuffer buffer = new VectorBuffer ( null , iFieldsTypes ) ; buffer . fieldsToBuffer ( this , iFieldsTypes ) ; boolean rgbModified [ ] = null ; if ( ( iChangeType != DBConstants . AFTER_DELETE_TYPE ) && ( this . isModified ( ) ) ) { boolean bLockRecord = this . getEditMode ( ) == DBConstants . EDIT_IN_PROGRESS ; // Second step , save which fields have been modified .
rgbModified = this . getModified ( ) ; // Third step - refresh the record
this . addNew ( ) ; Record newRecord = this . setHandle ( bookmark , iHandleType ) ; // Forth step - Move my changed fields to the refreshed record
if ( newRecord == null ) this . addNew ( ) ; else { if ( bLockRecord ) this . edit ( ) ; // If I haven ' t changed any data , just refresh it .
buffer . resetPosition ( ) ; for ( int iFieldSeq = 0 ; iFieldSeq < this . getFieldCount ( ) ; iFieldSeq ++ ) { Object dataScreen = buffer . getNextData ( ) ; if ( rgbModified [ iFieldSeq ] ) { // If I modified it
BaseField field = this . getField ( iFieldSeq ) ; if ( ( field . isVirtual ( ) ) && ( field . isModified ( ) ) ) continue ; // Special case - some field change modified a virtual field , leave it alone
Object dataUpdated = field . getData ( ) ; if ( ( ( dataUpdated != null ) && ( ! dataUpdated . equals ( dataScreen ) ) ) || ( ( dataUpdated == null ) && ( dataScreen != dataUpdated ) ) ) { // And it is different from the current data , merge data
field . mergeData ( dataScreen ) ; // This will set field modified to true
if ( field . isVirtual ( ) ) field . setData ( dataScreen ) ; // This will set just modified to false
if ( bWarningIfChanged ) iErrorCode = DBConstants . RECORD_CHANGED ; } } } } } else { this . addNew ( ) ; // Clear current bookmark
if ( iChangeType != DBConstants . AFTER_DELETE_TYPE ) this . setHandle ( bookmark , iHandleType ) ; } this . setEnableListeners ( rgbEnabled ) ; this . setEnableFieldListeners ( rgobjEnabledFields ) ; // Fifth step : If what is currently on the screen is different from the new merged data , re - call the handleFieldChanged ( SCREEN _ MOVE )
int iDBMasterSlave = 0 ; if ( ( this . getMasterSlave ( ) & RecordOwner . MASTER ) == 0 ) { iDBMasterSlave = this . getTable ( ) . getCurrentTable ( ) . getDatabase ( ) . getMasterSlave ( ) ; this . getTable ( ) . getCurrentTable ( ) . getDatabase ( ) . setMasterSlave ( RecordOwner . MASTER | RecordOwner . SLAVE ) ; } boolean bAnyChanged = this . checkAndHandleFieldChanges ( buffer , rgbModified , true ) ; if ( iDBMasterSlave != 0 ) this . getTable ( ) . getCurrentTable ( ) . getDatabase ( ) . setMasterSlave ( iDBMasterSlave ) ; this . setOpenMode ( iOldOpenMode ) ; // Some field listeners need to know I ' m refreshing , so I wait until checkAndHandleFieldChanges is done .
if ( bWarningIfChanged ) if ( bAnyChanged ) iErrorCode = DBConstants . RECORD_CHANGED ; } } } catch ( DBException ex ) { ex . printStackTrace ( ) ; } return iErrorCode ; |
public class DefaultArtifactUtil { /** * { @ inheritDoc } */
public void resolveFromRepositories ( Artifact artifact , List remoteRepositories , ArtifactRepository localRepository ) throws MojoExecutionException { } } | try { artifactResolver . resolve ( artifact , remoteRepositories , localRepository ) ; } catch ( ArtifactResolutionException e ) { throw new MojoExecutionException ( "Could not resolv artifact: " + artifact , e ) ; } catch ( ArtifactNotFoundException e ) { throw new MojoExecutionException ( "Could not find artifact: " + artifact , e ) ; } |
public class StringIterate { /** * For each int code point in the { @ code string } , execute the { @ link CodePointProcedure } .
* @ since 7.0 */
public static void forEachCodePoint ( String string , CodePointProcedure procedure ) { } } | int size = string . length ( ) ; for ( int i = 0 ; i < size ; ) { int codePoint = string . codePointAt ( i ) ; procedure . value ( codePoint ) ; i += Character . charCount ( codePoint ) ; } |
public class HostNameUtils { /** * Verifies whether or not the provided hostname references
* an interface on this machine . The provided name is unchanged by
* this operation .
* @ param hostName
* @ return true if the hostname refers to a method on this interface
* false if not . */
@ Trivial public static boolean validLocalHostName ( String hostName ) { } } | InetAddress addr = findLocalHostAddress ( hostName , PREFER_IPV6 ) ; return addr != null ; |
public class VirtualMachineImagesInner { /** * Gets a list of virtual machine image publishers for the specified Azure location .
* @ param location The name of a supported Azure region .
* @ 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 List & lt ; VirtualMachineImageResourceInner & gt ; object if successful . */
public List < VirtualMachineImageResourceInner > listPublishers ( String location ) { } } | return listPublishersWithServiceResponseAsync ( location ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class SparseGrid { /** * Creates a { @ code SparseGrid } copying from another grid .
* @ param < R > the type of the value
* @ param grid the grid to copy , not null
* @ return the mutable grid , not null */
public static < R > SparseGrid < R > create ( Grid < ? extends R > grid ) { } } | if ( grid == null ) { throw new IllegalArgumentException ( "Grid must not be null" ) ; } SparseGrid < R > created = SparseGrid . create ( grid . rowCount ( ) , grid . columnCount ( ) ) ; created . putAll ( grid ) ; return created ; |
public class WasDerivedFrom { /** * Gets the value of the usedEntity property .
* @ return
* possible object is
* { @ link org . openprovenance . prov . sql . IDRef } */
@ ManyToOne ( targetEntity = org . openprovenance . prov . sql . QualifiedName . class , cascade = { } } | CascadeType . ALL } ) @ JoinColumn ( name = "USED_ENTITY" ) public org . openprovenance . prov . model . QualifiedName getUsedEntity ( ) { return usedEntity ; |
public class GridDialects { /** * Returns that delegate of the given grid dialect of the given type . In case the given dialect itself is of the
* given type , it will be returned itself . In case the given grid dialect is a { @ link ForwardingGridDialect } , its
* delegates will recursively be searched , until the first delegate of the given type is found . */
public static < T extends GridDialect > T getDelegateOrNull ( GridDialect gridDialect , Class < T > delegateType ) { } } | if ( gridDialect . getClass ( ) == delegateType ) { return delegateType . cast ( gridDialect ) ; } else if ( gridDialect instanceof ForwardingGridDialect ) { return getDelegateOrNull ( ( ( ForwardingGridDialect < ? > ) gridDialect ) . getGridDialect ( ) , delegateType ) ; } else { return null ; } |
public class CommerceShippingFixedOptionPersistenceImpl { /** * Returns all the commerce shipping fixed options .
* @ return the commerce shipping fixed options */
@ Override public List < CommerceShippingFixedOption > findAll ( ) { } } | return findAll ( QueryUtil . ALL_POS , QueryUtil . ALL_POS , null ) ; |
public class StringUtils { /** * Escape regular expression special characters .
* @ param value input
* @ return input with regular expression special characters escaped */
public static String escapeRegExp ( final String value ) { } } | final StringBuilder buff = new StringBuilder ( ) ; if ( value == null || value . length ( ) == 0 ) { return "" ; } int index = 0 ; while ( index < value . length ( ) ) { final char current = value . charAt ( index ) ; switch ( current ) { case '.' : buff . append ( "\\." ) ; break ; // case ' / ' :
// case ' | ' :
case '\\' : buff . append ( "[\\\\|/]" ) ; break ; case '(' : buff . append ( "\\(" ) ; break ; case ')' : buff . append ( "\\)" ) ; break ; case '[' : buff . append ( "\\[" ) ; break ; case ']' : buff . append ( "\\]" ) ; break ; case '{' : buff . append ( "\\{" ) ; break ; case '}' : buff . append ( "\\}" ) ; break ; case '^' : buff . append ( "\\^" ) ; break ; case '+' : buff . append ( "\\+" ) ; break ; case '$' : buff . append ( "\\$" ) ; break ; default : buff . append ( current ) ; } index ++ ; } return buff . toString ( ) ; |
public class SynchronizedGeneratorIdentity { /** * Create a new { @ link SynchronizedGeneratorIdentity } instance .
* @ param quorum Addresses of the ZooKeeper quorum ( comma - separated ) .
* @ param znode Root znode of the ZooKeeper resource - pool .
* @ param claimDurationSupplier Provides the amount of time a claim to a generator - ID should be held . By using a
* { @ link Supplier } instead of a static long , this may dynamically reconfigured at
* runtime .
* @ return A { @ link SynchronizedGeneratorIdentity } instance . */
public static SynchronizedGeneratorIdentity basedOn ( String quorum , String znode , Supplier < Duration > claimDurationSupplier ) throws IOException { } } | ZooKeeperConnection zooKeeperConnection = new ZooKeeperConnection ( quorum ) ; int clusterId = ClusterID . get ( zooKeeperConnection . getActiveConnection ( ) , znode ) ; return new SynchronizedGeneratorIdentity ( zooKeeperConnection , znode , clusterId , claimDurationSupplier ) ; |
public class OrganizationNodeMarshaller { /** * Marshall the given parameter object . */
public void marshall ( OrganizationNode organizationNode , ProtocolMarshaller protocolMarshaller ) { } } | if ( organizationNode == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( organizationNode . getType ( ) , TYPE_BINDING ) ; protocolMarshaller . marshall ( organizationNode . getValue ( ) , VALUE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class CommentHandler { /** * Get a list of comments made for a particular entity
* @ param entityId - id of the commented entity
* @ param entityType - type of the entity
* @ return list of comments */
public List < DbComment > getComments ( String entityId , String entityType ) { } } | return repositoryHandler . getComments ( entityId , entityType ) ; |
public class Menu { /** * Layoutlib overrides this method to return its custom implementation of MenuItem */
private MenuItem createNewMenuItem ( int group , int id , int categoryOrder , int ordering , CharSequence title , int defaultShowAsAction ) { } } | return new MenuItem ( group , id , categoryOrder , title ) ; |
public class LoggingConfigurator { /** * Create a stderr appender .
* @ param context The logger context to use .
* @ return An appender writing to stderr . */
private static Appender < ILoggingEvent > getStdErrAppender ( final LoggerContext context , final ReplaceNewLines replaceNewLines ) { } } | // Setup format
final PatternLayoutEncoder encoder = new PatternLayoutEncoder ( ) ; encoder . setContext ( context ) ; encoder . setPattern ( "%date{HH:mm:ss.SSS} %property{ident}[%property{pid}]: %-5level [%thread] %logger{0}: " + ReplaceNewLines . getMsgPattern ( replaceNewLines ) + "%n" ) ; encoder . setCharset ( Charsets . UTF_8 ) ; encoder . start ( ) ; // Setup stderr appender
final ConsoleAppender < ILoggingEvent > appender = new ConsoleAppender < ILoggingEvent > ( ) ; appender . setTarget ( "System.err" ) ; appender . setName ( "stderr" ) ; appender . setEncoder ( encoder ) ; appender . setContext ( context ) ; appender . start ( ) ; return appender ; |
public class MediaApi { /** * Pull an Interaction from a Workbin
* @ param mediatype The media channel . ( required )
* @ param id The ID of the interaction . ( required )
* @ param pullInteractionFromWorkbinData ( optional )
* @ return ApiResponse & lt ; ApiSuccessResponse & gt ;
* @ throws ApiException If fail to call the API , e . g . server error or cannot deserialize the response body */
public ApiResponse < ApiSuccessResponse > pullInteractionFromWorkbinWithHttpInfo ( String mediatype , String id , PullInteractionFromWorkbinData pullInteractionFromWorkbinData ) throws ApiException { } } | com . squareup . okhttp . Call call = pullInteractionFromWorkbinValidateBeforeCall ( mediatype , id , pullInteractionFromWorkbinData , null , null ) ; Type localVarReturnType = new TypeToken < ApiSuccessResponse > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; |
public class CssEscape { /** * Perform a CSS Identifier level 1 ( only basic set ) < strong > escape < / strong > operation
* on a < tt > String < / tt > input .
* < em > Level 1 < / em > means this method will only escape the CSS Identifier basic escape set :
* < ul >
* < li > The < em > Backslash Escapes < / em > :
* < tt > & # 92 ; < / tt > ( < tt > U + 0020 < / tt > ) ,
* < tt > & # 92 ; ! < / tt > ( < tt > U + 0021 < / tt > ) ,
* < tt > & # 92 ; & quot ; < / tt > ( < tt > U + 0022 < / tt > ) ,
* < tt > & # 92 ; # < / tt > ( < tt > U + 0023 < / tt > ) ,
* < tt > & # 92 ; $ < / tt > ( < tt > U + 0024 < / tt > ) ,
* < tt > & # 92 ; % < / tt > ( < tt > U + 0025 < / tt > ) ,
* < tt > & # 92 ; & amp ; < / tt > ( < tt > U + 0026 < / tt > ) ,
* < tt > & # 92 ; & # 39 ; < / tt > ( < tt > U + 0027 < / tt > ) ,
* < tt > & # 92 ; ( < / tt > ( < tt > U + 0028 < / tt > ) ,
* < tt > & # 92 ; ) < / tt > ( < tt > U + 0029 < / tt > ) ,
* < tt > & # 92 ; * < / tt > ( < tt > U + 002A < / tt > ) ,
* < tt > & # 92 ; + < / tt > ( < tt > U + 002B < / tt > ) ,
* < tt > & # 92 ; , < / tt > ( < tt > U + 002C < / tt > ) ,
* < tt > & # 92 ; . < / tt > ( < tt > U + 002E < / tt > ) ,
* < tt > & # 92 ; & # 47 ; < / tt > ( < tt > U + 002F < / tt > ) ,
* < tt > & # 92 ; ; < / tt > ( < tt > U + 003B < / tt > ) ,
* < tt > & # 92 ; & lt ; < / tt > ( < tt > U + 003C < / tt > ) ,
* < tt > & # 92 ; = < / tt > ( < tt > U + 003D < / tt > ) ,
* < tt > & # 92 ; & gt ; < / tt > ( < tt > U + 003E < / tt > ) ,
* < tt > & # 92 ; ? < / tt > ( < tt > U + 003F < / tt > ) ,
* < tt > & # 92 ; @ < / tt > ( < tt > U + 0040 < / tt > ) ,
* < tt > & # 92 ; [ < / tt > ( < tt > U + 005B < / tt > ) ,
* < tt > & # 92 ; & # 92 ; < / tt > ( < tt > U + 005C < / tt > ) ,
* < tt > & # 92 ; ] < / tt > ( < tt > U + 005D < / tt > ) ,
* < tt > & # 92 ; ^ < / tt > ( < tt > U + 005E < / tt > ) ,
* < tt > & # 92 ; ` < / tt > ( < tt > U + 0060 < / tt > ) ,
* < tt > & # 92 ; { < / tt > ( < tt > U + 007B < / tt > ) ,
* < tt > & # 92 ; | < / tt > ( < tt > U + 007C < / tt > ) ,
* < tt > & # 92 ; } < / tt > ( < tt > U + 007D < / tt > ) and
* < tt > & # 92 ; ~ < / tt > ( < tt > U + 007E < / tt > ) .
* Note that the < tt > & # 92 ; - < / tt > ( < tt > U + 002D < / tt > ) escape sequence exists , but will only be used
* when an identifier starts with two hypens or hyphen + digit . Also , the < tt > & # 92 ; _ < / tt >
* ( < tt > U + 005F < / tt > ) escape will only be used at the beginning of an identifier to avoid
* problems with Internet Explorer 6 . In the same sense , note that the < tt > & # 92 ; : < / tt >
* ( < tt > U + 003A < / tt > ) escape sequence is also defined in the standard , but will not be
* used for escaping as Internet Explorer & lt ; 8 does not recognize it .
* < / li >
* < li >
* Two ranges of non - displayable , control characters : < tt > U + 0000 < / tt > to < tt > U + 001F < / tt >
* and < tt > U + 007F < / tt > to < tt > U + 009F < / tt > .
* < / li >
* < / ul >
* This escape will be performed by using Backslash escapes whenever possible . For escaped
* characters that do not have an associated Backslash , default to < tt > & # 92 ; FF < / tt >
* Hexadecimal Escapes .
* This method calls { @ link # escapeCssIdentifier ( String , CssIdentifierEscapeType , CssIdentifierEscapeLevel ) }
* with the following preconfigured values :
* < ul >
* < li > < tt > type < / tt > :
* { @ link CssIdentifierEscapeType # BACKSLASH _ ESCAPES _ DEFAULT _ TO _ COMPACT _ HEXA } < / li >
* < li > < tt > level < / tt > :
* { @ link CssIdentifierEscapeLevel # LEVEL _ 1 _ BASIC _ ESCAPE _ SET } < / li >
* < / ul >
* This method is < strong > thread - safe < / strong > .
* @ param text the < tt > String < / tt > to be escaped .
* @ return The escaped result < tt > String < / tt > . As a memory - performance improvement , will return the exact
* same object as the < tt > text < / tt > input argument if no escaping modifications were required ( and
* no additional < tt > String < / tt > objects will be created during processing ) . Will
* return < tt > null < / tt > if input is < tt > null < / tt > . */
public static String escapeCssIdentifierMinimal ( final String text ) { } } | return escapeCssIdentifier ( text , CssIdentifierEscapeType . BACKSLASH_ESCAPES_DEFAULT_TO_COMPACT_HEXA , CssIdentifierEscapeLevel . LEVEL_1_BASIC_ESCAPE_SET ) ; |
public class AbstractIDAuthority { /** * Returns the block size of the specified partition as determined by the configured { @ link IDBlockSizer } .
* @ param idNamespace
* @ return */
protected long getBlockSize ( final int idNamespace ) { } } | Preconditions . checkArgument ( blockSizer != null , "Blocksizer has not yet been initialized" ) ; isActive = true ; long blockSize = blockSizer . getBlockSize ( idNamespace ) ; Preconditions . checkArgument ( blockSize > 0 , "Invalid block size: %s" , blockSize ) ; Preconditions . checkArgument ( blockSize < getIdUpperBound ( idNamespace ) , "Block size [%s] cannot be larger than upper bound [%s] for partition [%s]" , blockSize , getIdUpperBound ( idNamespace ) , idNamespace ) ; return blockSize ; |
public class XsdAsmInterfaces { /** * Creates a class based on a { @ link XsdElement } if it wasn ' t been already .
* @ param elementName The name of the element . */
private void addToCreateElements ( String elementName ) { } } | HashMap < String , String > elementAttributes = new HashMap < > ( ) ; elementAttributes . put ( XsdAbstractElement . NAME_TAG , elementName ) ; if ( ! createdElements . containsKey ( getCleanName ( elementName ) ) ) { createdElements . put ( getCleanName ( elementName ) , new XsdElement ( null , elementAttributes ) ) ; } |
public class MExtensionFileFilter { /** * Adds a filetype " dot " extension to filter against .
* For example : the following code will create a filter that filters out all files except those that end in " . jpg " and " . tif " :
* MExtensionFileFilter filter = new MExtensionFileFilter ( ) ; filter . addExtension ( " jpg " ) ; filter . addExtension ( " tif " ) ;
* Note that the " . " before the extension is not needed and will be ignored .
* @ param extension
* String */
public final void addExtension ( final String extension ) { } } | if ( filters == null ) { filters = new HashMap < > ( 1 ) ; } filters . put ( extension . toLowerCase ( Locale . getDefault ( ) ) , this ) ; fullDescription = null ; |
public class ModularParser { /** * Algorithm to identify the first paragraph of a ParsedPage */
private void setFirstParagraph ( ParsedPage pp ) { } } | int nr = pp . nrOfParagraphs ( ) ; // the paragraph with the lowest number , must not be the first , maybe it
// is only an Image . . .
for ( int i = 0 ; i < nr ; i ++ ) { Paragraph p = pp . getParagraph ( i ) ; // get the Text from the paragraph
SpanManager ptext = new SpanManager ( p . getText ( ) ) ; List < Span > delete = new ArrayList < Span > ( ) ; ptext . manageList ( delete ) ; // getting the spans to remove from the text , for templates
List < Template > tl = p . getTemplates ( ) ; for ( int j = tl . size ( ) - 1 ; j >= 0 ; j -- ) { delete . add ( tl . get ( j ) . getPos ( ) ) ; } // getting the spans to remove from the text , for Tags
List < Span > sl = p . getFormatSpans ( FormatType . TAG ) ; for ( int j = sl . size ( ) - 1 ; j >= 0 ; j -- ) { delete . add ( sl . get ( j ) ) ; } // getting the spans to remove from the text , for image text
if ( showImageText ) { List < Link > ll = p . getLinks ( Link . type . IMAGE ) ; for ( int j = ll . size ( ) - 1 ; j >= 0 ; j -- ) { delete . add ( ll . get ( j ) . getPos ( ) ) ; } } // delete the spans in reverse order , the spans are managed , so
// there is no need to sort them
for ( int j = delete . size ( ) - 1 ; j >= 0 ; j -- ) { ptext . delete ( delete . remove ( j ) ) ; } // removing line separators if exist , so the result can be trimmed
// in the next step
int pos = ptext . indexOf ( lineSeparator ) ; while ( pos != - 1 ) { ptext . delete ( pos , pos + lineSeparator . length ( ) ) ; pos = ptext . indexOf ( lineSeparator ) ; } // if the result is not an empty string , we got the number of the
// first paragraph
if ( ! ptext . toString ( ) . trim ( ) . equals ( "" ) ) { pp . setFirstParagraphNr ( i ) ; return ; } } |
public class Packet { /** * Writes a single { @ code long } with the specified { @ link ByteOrder } to this { @ link Packet } ' s payload .
* @ param l A { @ code long } .
* @ param order The internal byte order of the { @ code long } .
* @ return The { @ link Packet } to allow for chained writes . */
public Packet putLong ( long l , ByteOrder order ) { } } | var buffer = HEAP_BUFFER_POOL . take ( Long . BYTES ) ; var array = buffer . putLong ( order == ByteOrder . LITTLE_ENDIAN ? Long . reverseBytes ( l ) : l ) . array ( ) ; try { return enqueue ( Arrays . copyOfRange ( array , 0 , Long . BYTES ) ) ; } finally { HEAP_BUFFER_POOL . give ( buffer ) ; } |
public class TextRowProtocol { /** * Get BigDecimal from raw text format .
* @ param columnInfo column information
* @ return BigDecimal value */
public BigDecimal getInternalBigDecimal ( ColumnInformation columnInfo ) { } } | if ( lastValueWasNull ( ) ) { return null ; } if ( columnInfo . getColumnType ( ) == ColumnType . BIT ) { return BigDecimal . valueOf ( parseBit ( ) ) ; } return new BigDecimal ( new String ( buf , pos , length , StandardCharsets . UTF_8 ) ) ; |
public class SyntheticStorableBuilder { /** * ( non - Javadoc )
* @ see com . amazon . carbonado . synthetic . SyntheticBuilder # addProperty ( java . lang . String ,
* java . lang . Class ) */
public SyntheticProperty addProperty ( String name , Class type ) { } } | SyntheticProperty prop = new SyntheticProperty ( name , type ) ; mPropertyList . add ( prop ) ; return prop ; |
public class Table { /** * Check if the passed importedKey is already present or not in a existing ForeignKey of size 1. */
public boolean alreadyPresent ( ImportedKey importedKey ) { } } | if ( foreignKeysByName == null ) { return false ; } Collection < ForeignKey > fks = foreignKeysByName . values ( ) ; if ( fks == null ) { return false ; } for ( ForeignKey fk : fks ) { if ( fk . getSize ( ) == 1 ) { ImportedKey other = fk . getImportedKey ( ) ; // Note : we just need to compare the FkColumnName , if we have a match , we consider
// that this is an error in the conf , and we skip . No need to compare pkTable and pkCol
boolean same = importedKey . getFkColumnName ( ) . equalsIgnoreCase ( other . getFkColumnName ( ) ) ; if ( same ) { return true ; } } } return false ; |
public class Node { /** * TODO ( johnlenz ) : make this final */
@ Nullable public String getSourceFileName ( ) { } } | StaticSourceFile file = getStaticSourceFile ( ) ; return file == null ? null : file . getName ( ) ; |
public class Model { /** * Adds the object to the ids list .
* @ throws com . mauriciogiordano . easydb . exception . NoContextFoundException in case of null context . */
private void addObject ( ) { } } | SharedPreferences prefs = loadSharedPreferences ( "objectList" ) ; List < String > objects = getObjectList ( ) ; objects . add ( getId ( ) ) ; prefs . edit ( ) . putString ( "list" , StringUtils . join ( objects , "," ) ) . commit ( ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.