signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class UpdatableResultSet { /** * { inheritDoc } . */
public void updateTime ( String columnLabel , Time value ) throws SQLException { } } | updateTime ( findColumn ( columnLabel ) , value ) ; |
public class JDBCStorageConnection { /** * Return permission values or throw an exception . We assume the node is mix : privilegeable .
* @ param cid
* Node id
* @ return list of ACL entries
* @ throws SQLException
* database error
* @ throws IllegalACLException
* if property exo : permissions is not found for node */
protected List < AccessControlEntry > readACLPermisions ( String cid ) throws SQLException , IllegalACLException { } } | List < AccessControlEntry > naPermissions = new ArrayList < AccessControlEntry > ( ) ; ResultSet exoPerm = findPropertyByName ( cid , Constants . EXO_PERMISSIONS . getAsString ( ) ) ; try { if ( exoPerm . next ( ) ) { do { naPermissions . add ( AccessControlEntry . parse ( new String ( exoPerm . getBytes ( COLUMN_VDATA ) ) ) ) ; } while ( exoPerm . next ( ) ) ; return naPermissions ; } else { throw new IllegalACLException ( "Property exo:permissions is not found for node with id: " + getIdentifier ( cid ) ) ; } } finally { try { exoPerm . close ( ) ; } catch ( SQLException e ) { LOG . error ( "Can't close the ResultSet: " + e . getMessage ( ) ) ; } } |
public class PartnerLogTable { /** * You ' d better be surrounded by write lock / unlock calls when you call this */
protected void addPartnerEntry ( PartnerLogData logData ) { } } | if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "addPartnerEntry" , logData ) ; final int result = _partnerLogTable . size ( ) ; _partnerLogTable . add ( result , logData ) ; // Let the entry know where it ' s been put
// Actually , fool it into thinking it ' s one entry higher to invalidate 0
logData . setIndex ( result + 1 ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "addPartnerEntry" , result + 1 ) ; |
public class AppFeedItem { /** * Gets the appStore value for this AppFeedItem .
* @ return appStore * The application store that the target application belongs to . */
public com . google . api . ads . adwords . axis . v201809 . cm . AppFeedItemAppStore getAppStore ( ) { } } | return appStore ; |
public class filterpolicy { /** * Use this API to fetch filterpolicy resources of given names . */
public static filterpolicy [ ] get ( nitro_service service , String name [ ] ) throws Exception { } } | if ( name != null && name . length > 0 ) { filterpolicy response [ ] = new filterpolicy [ name . length ] ; filterpolicy obj [ ] = new filterpolicy [ name . length ] ; for ( int i = 0 ; i < name . length ; i ++ ) { obj [ i ] = new filterpolicy ( ) ; obj [ i ] . set_name ( name [ i ] ) ; response [ i ] = ( filterpolicy ) obj [ i ] . get_resource ( service ) ; } return response ; } return null ; |
public class Sets { /** * Returns the difference of sets s1 and s2. */
public static < E > Set < E > diff ( Set < E > s1 , Set < E > s2 ) { } } | Set < E > s = new HashSet < E > ( ) ; for ( E o : s1 ) { if ( ! s2 . contains ( o ) ) { s . add ( o ) ; } } return s ; |
public class DefaultWelcomeFileMapping { /** * Setter
* @ param welcomeFiles welcome files */
public void setWelcomeFiles ( String [ ] welcomeFiles ) { } } | if ( welcomeFiles != null ) { this . welcomeFiles = Arrays . copyOf ( welcomeFiles , welcomeFiles . length ) ; } |
public class MtasSolrStatus { /** * Sets the key .
* @ param key
* the new key
* @ throws IOException
* Signals that an I / O exception has occurred . */
public void setKey ( String key ) throws IOException { } } | if ( this . key != null ) { throw new IOException ( "key already set" ) ; } else { this . key = Objects . requireNonNull ( key , "key required" ) ; } |
public class NIOTcpListener { /** * ( non - Javadoc )
* @ see net . timewalker . ffmq4 . listeners . AbstractListener # stop ( ) */
@ Override public void stop ( ) { } } | if ( ! started ) return ; log . info ( "Stopping listener [" + getName ( ) + "]" ) ; // Close the listen socket
multiplexer . unregisterServerSocketHandler ( this ) ; multiplexer . stop ( ) ; multiplexer = null ; // Close remaining clients
closeRemainingClients ( ) ; started = false ; |
public class Query { /** * Validates the filters , making sure each metric has a filter
* @ throws IllegalArgumentException if one or more parameters were invalid */
private void validateFilters ( ) { } } | Set < String > ids = new HashSet < String > ( ) ; for ( Filter filter : filters ) { ids . add ( filter . getId ( ) ) ; } for ( Metric metric : metrics ) { if ( metric . getFilter ( ) != null && ! metric . getFilter ( ) . isEmpty ( ) && ! ids . contains ( metric . getFilter ( ) ) ) { throw new IllegalArgumentException ( String . format ( "unrecognized filter id %s in metric %s" , metric . getFilter ( ) , metric . getId ( ) ) ) ; } } |
public class CronTab { /** * Computes the nearest past timestamp that matched this cron tab .
* More precisely , given the time ' t ' , computes another smallest time x such that :
* < ul >
* < li > x & lt ; = t ( inclusive )
* < li > x matches this crontab
* < / ul >
* Note that if t already matches this cron , it ' s returned as is . */
public Calendar floor ( long t ) { } } | Calendar cal = new GregorianCalendar ( Locale . US ) ; cal . setTimeInMillis ( t ) ; return floor ( cal ) ; |
public class Operation { /** * If the variable is a local temporary variable it will be resized so that the operation can complete . If not
* temporary then it will not be reshaped
* @ param mat Variable containing the matrix
* @ param numRows Desired number of rows
* @ param numCols Desired number of columns */
protected void resize ( VariableMatrix mat , int numRows , int numCols ) { } } | if ( mat . isTemp ( ) ) { mat . matrix . reshape ( numRows , numCols ) ; } |
public class ZooKeeperUtils { /** * Starts a { @ link CuratorFramework } instance and connects it to the given ZooKeeper
* quorum .
* @ param configuration { @ link Configuration } object containing the configuration values
* @ return { @ link CuratorFramework } instance */
public static CuratorFramework startCuratorFramework ( Configuration configuration ) { } } | Preconditions . checkNotNull ( configuration , "configuration" ) ; String zkQuorum = configuration . getValue ( HighAvailabilityOptions . HA_ZOOKEEPER_QUORUM ) ; if ( zkQuorum == null || StringUtils . isBlank ( zkQuorum ) ) { throw new RuntimeException ( "No valid ZooKeeper quorum has been specified. " + "You can specify the quorum via the configuration key '" + HighAvailabilityOptions . HA_ZOOKEEPER_QUORUM . key ( ) + "'." ) ; } int sessionTimeout = configuration . getInteger ( HighAvailabilityOptions . ZOOKEEPER_SESSION_TIMEOUT ) ; int connectionTimeout = configuration . getInteger ( HighAvailabilityOptions . ZOOKEEPER_CONNECTION_TIMEOUT ) ; int retryWait = configuration . getInteger ( HighAvailabilityOptions . ZOOKEEPER_RETRY_WAIT ) ; int maxRetryAttempts = configuration . getInteger ( HighAvailabilityOptions . ZOOKEEPER_MAX_RETRY_ATTEMPTS ) ; String root = configuration . getValue ( HighAvailabilityOptions . HA_ZOOKEEPER_ROOT ) ; String namespace = configuration . getValue ( HighAvailabilityOptions . HA_CLUSTER_ID ) ; boolean disableSaslClient = configuration . getBoolean ( SecurityOptions . ZOOKEEPER_SASL_DISABLE ) ; ACLProvider aclProvider ; ZkClientACLMode aclMode = ZkClientACLMode . fromConfig ( configuration ) ; if ( disableSaslClient && aclMode == ZkClientACLMode . CREATOR ) { String errorMessage = "Cannot set ACL role to " + aclMode + " since SASL authentication is " + "disabled through the " + SecurityOptions . ZOOKEEPER_SASL_DISABLE . key ( ) + " property" ; LOG . warn ( errorMessage ) ; throw new IllegalConfigurationException ( errorMessage ) ; } if ( aclMode == ZkClientACLMode . CREATOR ) { LOG . info ( "Enforcing creator for ZK connections" ) ; aclProvider = new SecureAclProvider ( ) ; } else { LOG . info ( "Enforcing default ACL for ZK connections" ) ; aclProvider = new DefaultACLProvider ( ) ; } String rootWithNamespace = generateZookeeperPath ( root , namespace ) ; LOG . info ( "Using '{}' as Zookeeper namespace." , rootWithNamespace ) ; CuratorFramework cf = CuratorFrameworkFactory . builder ( ) . connectString ( zkQuorum ) . sessionTimeoutMs ( sessionTimeout ) . connectionTimeoutMs ( connectionTimeout ) . retryPolicy ( new ExponentialBackoffRetry ( retryWait , maxRetryAttempts ) ) // Curator prepends a ' / ' manually and throws an Exception if the
// namespace starts with a ' / ' .
. namespace ( rootWithNamespace . startsWith ( "/" ) ? rootWithNamespace . substring ( 1 ) : rootWithNamespace ) . aclProvider ( aclProvider ) . build ( ) ; cf . start ( ) ; return cf ; |
public class RuleParser { /** * Set indicated external - xacml3 node to be the leaves of the MIDD
* @ param midd
* @ param extNode */
@ SuppressWarnings ( "rawtypes" ) private void setEffectNode ( AbstractNode midd , ExternalNode3 extNode ) throws MIDDException { } } | // Replace current external nodes in the MIDD with the extNode ( XACML 3 external node )
if ( ! ( midd instanceof InternalNode ) ) { throw new IllegalArgumentException ( "MIDD argument must not be an ExternalNode" ) ; } InternalNode currentNode = ( InternalNode ) midd ; Stack < InternalNode > stackNodes = new Stack < InternalNode > ( ) ; stackNodes . push ( currentNode ) ; while ( ! stackNodes . empty ( ) ) { InternalNode n = stackNodes . pop ( ) ; // Change indeterminate state of the internal node ,
// - By default is NotApplicable ( XACML 3.0 , sec 7.3.5 , 7.19.3)
// - If the attribute " MustBePresent " is true , then state is " Indeterminate _ P " if Effect is " Permit " ,
// " Indeterminate _ D " if Effect is " Deny " - XACML 3.0 , section 7.11
if ( n . getStateIN ( ) == DecisionType . Indeterminate ) { // this attribute has ' MustBePresent ' = true
if ( ruleEffect == DecisionType . Deny ) { n . setState ( new InternalNodeState ( nl . uva . sne . midd . DecisionType . Indeterminate_D ) ) ; } else if ( ruleEffect == DecisionType . Permit ) { n . setState ( new InternalNodeState ( nl . uva . sne . midd . DecisionType . Indeterminate_P ) ) ; } } // else {
// n . setState ( new InternalNodeState ( nl . uva . sne . midd . DecisionType . NotApplicable ) ) ;
// search for all children of the poped internal node
@ SuppressWarnings ( "unchecked" ) Iterator < AbstractEdge > it = n . getEdges ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { AbstractEdge edge = it . next ( ) ; AbstractNode child = edge . getSubDiagram ( ) ; if ( child instanceof InternalNode ) { stackNodes . push ( ( InternalNode ) child ) ; } else { edge . setSubDiagram ( extNode ) ; // set the final edge pointing to the xacml3 external node .
} } } |
public class AfplibFactoryImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public MDDXmBase createMDDXmBaseFromString ( EDataType eDataType , String initialValue ) { } } | MDDXmBase result = MDDXmBase . get ( initialValue ) ; if ( result == null ) throw new IllegalArgumentException ( "The value '" + initialValue + "' is not a valid enumerator of '" + eDataType . getName ( ) + "'" ) ; return result ; |
public class AmazonRoute53ResolverClient { /** * Gets information about a specified resolver endpoint , such as whether it ' s an inbound or an outbound resolver
* endpoint , and the current status of the endpoint .
* @ param getResolverEndpointRequest
* @ return Result of the GetResolverEndpoint operation returned by the service .
* @ throws ResourceNotFoundException
* The specified resource doesn ' t exist .
* @ throws InvalidParameterException
* One or more parameters in this request are not valid .
* @ throws InternalServiceErrorException
* We encountered an unknown error . Try again in a few minutes .
* @ throws ThrottlingException
* The request was throttled . Try again in a few minutes .
* @ sample AmazonRoute53Resolver . GetResolverEndpoint
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / route53resolver - 2018-04-01 / GetResolverEndpoint "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public GetResolverEndpointResult getResolverEndpoint ( GetResolverEndpointRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeGetResolverEndpoint ( request ) ; |
public class AttributeKeyAndValueMarshaller { /** * Marshall the given parameter object . */
public void marshall ( AttributeKeyAndValue attributeKeyAndValue , ProtocolMarshaller protocolMarshaller ) { } } | if ( attributeKeyAndValue == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( attributeKeyAndValue . getKey ( ) , KEY_BINDING ) ; protocolMarshaller . marshall ( attributeKeyAndValue . getValue ( ) , VALUE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class MetricsInputStream { /** * { @ inheritDoc }
* Record the read time into the metrics . */
@ Override public int read ( ) throws IOException { } } | if ( metrics != null ) { metrics . startEvent ( Field . HttpSocketReadTime ) ; } try { return in . read ( ) ; } finally { if ( metrics != null ) { metrics . endEvent ( Field . HttpSocketReadTime ) ; } } |
public class TrackerMeanShiftLikelihood { /** * Used to set the location of the track without changing any appearance history .
* @ param location new location */
public void setTrackLocation ( RectangleLength2D_I32 location ) { } } | this . location . set ( location ) ; // massage the rectangle so that it has an odd width and height
// otherwise it could experience a bias when localizing
this . location . width += 1 - this . location . width % 2 ; this . location . height += 1 - this . location . height % 2 ; failed = false ; |
public class ReportServlet { /** * { @ inheritDoc } */
@ Override public void init ( ServletConfig config ) { } } | this . servletConfig = config ; httpAuth = new HttpAuth ( ) ; LOG . debug ( "JavaMelody report servlet initialized" ) ; |
public class ICECandidate { /** * Compare the to other Transport candidate .
* @ param arg another Transport candidate
* @ return a negative integer , zero , or a positive integer as this
* object is less than , equal to , or greater than the specified
* object */
@ Override public int compareTo ( ICECandidate arg ) { } } | if ( getPreference ( ) < arg . getPreference ( ) ) { return - 1 ; } else if ( getPreference ( ) > arg . getPreference ( ) ) { return 1 ; } return 0 ; |
public class ClassNode { /** * Specify the class represented by this ` ClassNode ` extends
* a class with the name specified
* @ param name the name of the parent class
* @ return this ` ClassNode ` instance */
public ClassNode parent ( String name ) { } } | this . parent = infoBase . node ( name ) ; this . parent . addChild ( this ) ; for ( ClassNode intf : parent . interfaces . values ( ) ) { addInterface ( intf ) ; } return this ; |
public class ExperimentHelper { /** * To check if two input date string is same date with no matter about 2nd
* input ' s separator
* @ param date1 1st input date string with format yyyymmdd
* @ param date2 2nd input date string with format mmdd or mm - dd
* @ param separator The separator used in 2nd string
* @ return comparison result */
private static boolean isSameDate ( String date1 , String date2 , String separator ) { } } | date2 = date2 . replace ( separator , "" ) ; if ( date2 . equals ( "0229" ) ) { try { int year1 = Integer . parseInt ( date1 . substring ( 2 , 4 ) ) ; if ( year1 % 4 != 0 ) { return date1 . endsWith ( "0228" ) ; } } catch ( Exception e ) { return false ; } } return date1 . endsWith ( date2 ) ; |
public class ResourceRecordSet { /** * Information about the resource records to act upon .
* < note >
* If you ' re creating an alias resource record set , omit < code > ResourceRecords < / code > .
* < / note >
* @ param resourceRecords
* Information about the resource records to act upon . < / p > < note >
* If you ' re creating an alias resource record set , omit < code > ResourceRecords < / code > . */
public void setResourceRecords ( java . util . Collection < ResourceRecord > resourceRecords ) { } } | if ( resourceRecords == null ) { this . resourceRecords = null ; return ; } this . resourceRecords = new com . amazonaws . internal . SdkInternalList < ResourceRecord > ( resourceRecords ) ; |
public class ElemNumber { /** * This function is called after everything else has been
* recomposed , and allows the template to set remaining
* values that may be based on some other property that
* depends on recomposition . */
public void compose ( StylesheetRoot sroot ) throws TransformerException { } } | super . compose ( sroot ) ; StylesheetRoot . ComposeState cstate = sroot . getComposeState ( ) ; java . util . Vector vnames = cstate . getVariableNames ( ) ; if ( null != m_countMatchPattern ) m_countMatchPattern . fixupVariables ( vnames , cstate . getGlobalsSize ( ) ) ; if ( null != m_format_avt ) m_format_avt . fixupVariables ( vnames , cstate . getGlobalsSize ( ) ) ; if ( null != m_fromMatchPattern ) m_fromMatchPattern . fixupVariables ( vnames , cstate . getGlobalsSize ( ) ) ; if ( null != m_groupingSeparator_avt ) m_groupingSeparator_avt . fixupVariables ( vnames , cstate . getGlobalsSize ( ) ) ; if ( null != m_groupingSize_avt ) m_groupingSize_avt . fixupVariables ( vnames , cstate . getGlobalsSize ( ) ) ; if ( null != m_lang_avt ) m_lang_avt . fixupVariables ( vnames , cstate . getGlobalsSize ( ) ) ; if ( null != m_lettervalue_avt ) m_lettervalue_avt . fixupVariables ( vnames , cstate . getGlobalsSize ( ) ) ; if ( null != m_valueExpr ) m_valueExpr . fixupVariables ( vnames , cstate . getGlobalsSize ( ) ) ; |
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EClass getIfcAnnotationSurfaceOccurrence ( ) { } } | if ( ifcAnnotationSurfaceOccurrenceEClass == null ) { ifcAnnotationSurfaceOccurrenceEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 18 ) ; } return ifcAnnotationSurfaceOccurrenceEClass ; |
public class Backend { /** * Get information about all registered { @ link IndexProvider } s .
* @ return */
public Map < String , IndexInformation > getIndexInformation ( ) { } } | ImmutableMap . Builder < String , IndexInformation > copy = ImmutableMap . builder ( ) ; copy . putAll ( indexes ) ; return copy . build ( ) ; |
public class LocalTypeDetector { /** * implements the visitor to create and clear the stack and suspectLocals
* @ param classContext
* the context object of the currently parsed class */
@ Override public void visitClassContext ( ClassContext classContext ) { } } | try { stack = new OpcodeStack ( ) ; suspectLocals = new HashMap < > ( ) ; classVersion = classContext . getJavaClass ( ) . getMajor ( ) ; super . visitClassContext ( classContext ) ; } finally { stack = null ; suspectLocals = null ; } |
public class ReflectiveInterceptor { /** * Called to satisfy an invocation of java . lang . Class . getDeclaredAnnotations ( ) .
* @ param clazz the class upon which the original call was being invoked
* @ return array of annotations on the class */
public static Annotation [ ] jlClassGetDeclaredAnnotations ( Class < ? > clazz ) { } } | if ( TypeRegistry . nothingReloaded ) { return clazz . getDeclaredAnnotations ( ) ; } ReloadableType rtype = getReloadableTypeIfHasBeenReloaded ( clazz ) ; if ( rtype == null ) { return clazz . getDeclaredAnnotations ( ) ; } CurrentLiveVersion clv = rtype . getLiveVersion ( ) ; return clv . getExecutorClass ( ) . getDeclaredAnnotations ( ) ; |
public class DateUtils { /** * 生成java . util . Date类型的对象
* @ param year int 年
* @ param month int 月
* @ param day int 日
* @ return Date java . util . Date类型的对象 */
public static Date getDate ( int year , int month , int day ) { } } | GregorianCalendar d = new GregorianCalendar ( year , month - 1 , day ) ; return d . getTime ( ) ; |
public class ExpressionUtils { /** * Convert the given like pattern to a regex pattern
* @ param expr expression to be converted
* @ param matchStartAndEnd if start and end should be matched as well
* @ return converted expression */
@ SuppressWarnings ( "unchecked" ) public static Expression < String > likeToRegex ( Expression < String > expr , boolean matchStartAndEnd ) { } } | // TODO : this should take the escape character into account
if ( expr instanceof Constant < ? > ) { final String like = expr . toString ( ) ; final StringBuilder rv = new StringBuilder ( like . length ( ) + 4 ) ; if ( matchStartAndEnd && ! like . startsWith ( "%" ) ) { rv . append ( '^' ) ; } for ( int i = 0 ; i < like . length ( ) ; i ++ ) { char ch = like . charAt ( i ) ; if ( ch == '.' || ch == '*' || ch == '?' ) { rv . append ( '\\' ) ; } else if ( ch == '%' ) { rv . append ( ".*" ) ; continue ; } else if ( ch == '_' ) { rv . append ( '.' ) ; continue ; } rv . append ( ch ) ; } if ( matchStartAndEnd && ! like . endsWith ( "%" ) ) { rv . append ( '$' ) ; } if ( ! like . equals ( rv . toString ( ) ) ) { return ConstantImpl . create ( rv . toString ( ) ) ; } } else if ( expr instanceof Operation < ? > ) { Operation < ? > o = ( Operation < ? > ) expr ; if ( o . getOperator ( ) == Ops . CONCAT ) { Expression < String > lhs = likeToRegex ( ( Expression < String > ) o . getArg ( 0 ) , false ) ; Expression < String > rhs = likeToRegex ( ( Expression < String > ) o . getArg ( 1 ) , false ) ; if ( lhs != o . getArg ( 0 ) || rhs != o . getArg ( 1 ) ) { return operation ( String . class , Ops . CONCAT , lhs , rhs ) ; } } } return expr ; |
public class ByteBufferUtils { /** * 查看ByteBuffer数组是否还有剩余
* @ param buffers ByteBuffers
* @ return have remaining */
public static final boolean hasRemaining ( ByteBuffer [ ] buffers ) { } } | if ( buffers == null ) { return false ; } for ( int i = 0 ; i < buffers . length ; i ++ ) { if ( buffers [ i ] != null && buffers [ i ] . hasRemaining ( ) ) { return true ; } } return false ; |
public class ManagementVertex { /** * Returns the input gate at the given index .
* @ param index
* the index of the input gate to be returned
* @ return the input gate at the given index or < code > null < / code > if no such input gate exists */
public ManagementGate getInputGate ( final int index ) { } } | if ( index < this . inputGates . size ( ) ) { return this . inputGates . get ( index ) ; } return null ; |
public class SimpleEntry { /** * { @ inheritDoc } */
@ Override public T setValue ( T value ) { } } | T old = array [ actualIndex ] ; array [ actualIndex ] = value ; return old ; |
public class Arrangement { /** * 排列选择 ( 从列表中选择m个排列 )
* @ param m 选择个数
* @ return 所有排列列表 */
public List < String [ ] > select ( int m ) { } } | final List < String [ ] > result = new ArrayList < > ( ( int ) count ( this . datas . length , m ) ) ; select ( new String [ m ] , 0 , result ) ; return result ; |
public class CmsAliasManager { /** * Checks that the user has permissions for a mass edit operation in a given site . < p >
* @ param cms the current CMS context
* @ param siteRoot the site for which the permissions should be checked
* @ throws CmsException if something goes wrong */
private void checkPermissionsForMassEdit ( CmsObject cms , String siteRoot ) throws CmsException { } } | String originalSiteRoot = cms . getRequestContext ( ) . getSiteRoot ( ) ; try { cms . getRequestContext ( ) . setSiteRoot ( siteRoot ) ; checkPermissionsForMassEdit ( cms ) ; } finally { cms . getRequestContext ( ) . setSiteRoot ( originalSiteRoot ) ; } |
public class SameDiff { /** * Evaluation for multiple output networks - one ore more
* See { @ link # evaluate ( MultiDataSetIterator , Map , Map ) } */
public void evaluateMultiple ( DataSetIterator iterator , Map < String , List < IEvaluation > > variableEvals ) { } } | Map < String , Integer > map = new HashMap < > ( ) ; for ( String s : variableEvals . keySet ( ) ) { map . put ( s , 0 ) ; // Only 1 possible output here with DataSetIterator
} evaluate ( new MultiDataSetIteratorAdapter ( iterator ) , variableEvals , map ) ; |
public class FullTextSearchParser { /** * Parse the full - text search criteria given in the supplied string .
* @ param fullTextSearchExpression the full - text search expression ; may not be null
* @ return the term representation of the full - text search , or null if there are no terms
* @ throws ParsingException if there is an error parsing the supplied string
* @ throws IllegalArgumentException if the expression is null */
public Term parse ( String fullTextSearchExpression ) { } } | CheckArg . isNotNull ( fullTextSearchExpression , "fullTextSearchExpression" ) ; Tokenizer tokenizer = new TermTokenizer ( ) ; TokenStream stream = new TokenStream ( fullTextSearchExpression , tokenizer , false ) ; return parse ( stream . start ( ) ) ; |
public class DefaultDataLoader { /** * Execute a DBUbit operation */
private void executeOperation ( DbUnitDatabasePopulator populator , DataSource dataSource ) throws Exception { } } | Connection connection = null ; try { connection = getConnection ( dataSource ) ; populator . populate ( connection ) ; } finally { if ( connection != null && ! isConnectionTransactional ( connection , dataSource ) ) { // if the connection is transactional , closing it . Otherwise ,
// expects that the framework will do it
releaseConnection ( connection , dataSource ) ; } } |
public class LogPanel { /** * Get an existing or create a new progress bar .
* @ param prog Progress
* @ return Associated progress bar . */
private JProgressBar getOrCreateProgressBar ( Progress prog ) { } } | JProgressBar pbar = pbarmap . get ( prog ) ; // Add a new progress bar .
if ( pbar == null ) { synchronized ( pbarmap ) { if ( prog instanceof FiniteProgress ) { pbar = new JProgressBar ( 0 , ( ( FiniteProgress ) prog ) . getTotal ( ) ) ; pbar . setStringPainted ( true ) ; } else if ( prog instanceof IndefiniteProgress ) { pbar = new JProgressBar ( ) ; pbar . setIndeterminate ( true ) ; pbar . setStringPainted ( true ) ; } else if ( prog instanceof MutableProgress ) { pbar = new JProgressBar ( 0 , ( ( MutableProgress ) prog ) . getTotal ( ) ) ; pbar . setStringPainted ( true ) ; } else { throw new RuntimeException ( "Unsupported progress record" ) ; } pbarmap . put ( prog , pbar ) ; final JProgressBar pbar2 = pbar ; // Make final
SwingUtilities . invokeLater ( ( ) -> addProgressBar ( pbar2 ) ) ; } } return pbar ; |
public class SURT { /** * Allow class to be used as a command - line tool for converting
* URL lists ( or naked host or host / path fragments implied
* to be HTTP URLs ) to SURT form . Lines that cannot be converted
* are returned unchanged .
* Read from stdin or first file argument . Writes to stdout or
* second argument filename
* @ param args cmd - line arguments
* @ throws IOException */
public static void main ( String [ ] args ) throws IOException { } } | InputStream in = args . length > 0 ? new BufferedInputStream ( new FileInputStream ( args [ 0 ] ) ) : System . in ; PrintStream out = args . length > 1 ? new PrintStream ( new BufferedOutputStream ( new FileOutputStream ( args [ 1 ] ) ) ) : System . out ; BufferedReader br = new BufferedReader ( new InputStreamReader ( in ) ) ; String line ; while ( ( line = br . readLine ( ) ) != null ) { if ( line . indexOf ( "#" ) > 0 ) line = line . substring ( 0 , line . indexOf ( "#" ) ) ; line = line . trim ( ) ; if ( line . length ( ) == 0 ) continue ; line = ArchiveUtils . addImpliedHttpIfNecessary ( line ) ; out . println ( SURT . fromURI ( line ) ) ; } br . close ( ) ; out . close ( ) ; |
public class Treebank { /** * Return various statistics about the treebank ( number of sentences ,
* words , tag set , etc . ) .
* @ param tlp The TreebankLanguagePack used to determine punctuation and an
* appropriate character encoding
* @ return A big string for human consumption describing the treebank */
public String textualSummary ( TreebankLanguagePack tlp ) { } } | int numTrees = 0 ; int numTreesLE40 = 0 ; int numNonUnaryRoots = 0 ; Tree nonUnaryEg = null ; ClassicCounter < Tree > nonUnaries = new ClassicCounter < Tree > ( ) ; ClassicCounter < String > roots = new ClassicCounter < String > ( ) ; ClassicCounter < String > starts = new ClassicCounter < String > ( ) ; ClassicCounter < String > puncts = new ClassicCounter < String > ( ) ; int numUnenclosedLeaves = 0 ; int numLeaves = 0 ; int numNonPhrasal = 0 ; int numPreTerminalWithMultipleChildren = 0 ; int numWords = 0 ; int numTags = 0 ; int shortestSentence = Integer . MAX_VALUE ; int longestSentence = 0 ; int numNullLabel = 0 ; Set < String > words = new HashSet < String > ( ) ; ClassicCounter < String > tags = new ClassicCounter < String > ( ) ; ClassicCounter < String > cats = new ClassicCounter < String > ( ) ; Tree leafEg = null ; Tree preTerminalMultipleChildrenEg = null ; Tree nullLabelEg = null ; Tree rootRewritesAsTaggedWordEg = null ; for ( Tree t : this ) { roots . incrementCount ( t . value ( ) ) ; numTrees ++ ; int leng = t . yield ( ) . size ( ) ; if ( leng <= 40 ) { numTreesLE40 ++ ; } if ( leng < shortestSentence ) { shortestSentence = leng ; } if ( leng > longestSentence ) { longestSentence = leng ; } if ( t . numChildren ( ) > 1 ) { if ( numNonUnaryRoots == 0 ) { nonUnaryEg = t ; } if ( numNonUnaryRoots < 100 ) { nonUnaries . incrementCount ( t . localTree ( ) ) ; } numNonUnaryRoots ++ ; } else if ( t . isLeaf ( ) ) { numUnenclosedLeaves ++ ; } else { Tree t2 = t . firstChild ( ) ; if ( t2 . isLeaf ( ) ) { numLeaves ++ ; leafEg = t ; } else if ( t2 . isPreTerminal ( ) ) { if ( numNonPhrasal == 0 ) { rootRewritesAsTaggedWordEg = t ; } numNonPhrasal ++ ; } starts . incrementCount ( t2 . value ( ) ) ; } for ( Tree subtree : t ) { Label lab = subtree . label ( ) ; if ( lab == null || lab . value ( ) == null || "" . equals ( lab . value ( ) ) ) { if ( numNullLabel == 0 ) { nullLabelEg = subtree ; } numNullLabel ++ ; if ( lab == null ) { subtree . setLabel ( new StringLabel ( "" ) ) ; } else if ( lab . value ( ) == null ) { subtree . label ( ) . setValue ( "" ) ; } } if ( subtree . isLeaf ( ) ) { numWords ++ ; words . add ( subtree . value ( ) ) ; } else if ( subtree . isPreTerminal ( ) ) { numTags ++ ; tags . incrementCount ( subtree . value ( ) ) ; if ( tlp != null && tlp . isPunctuationTag ( subtree . value ( ) ) ) { puncts . incrementCount ( subtree . firstChild ( ) . value ( ) ) ; } } else if ( subtree . isPhrasal ( ) ) { boolean hasLeafChild = false ; for ( Tree kt : subtree . children ( ) ) { if ( kt . isLeaf ( ) ) { hasLeafChild = true ; } } if ( hasLeafChild ) { numPreTerminalWithMultipleChildren ++ ; if ( preTerminalMultipleChildrenEg == null ) { preTerminalMultipleChildrenEg = subtree ; } } cats . incrementCount ( subtree . value ( ) ) ; } else { throw new IllegalStateException ( "Treebank: Bad tree in treebank!: " + subtree ) ; } } } StringWriter sw = new StringWriter ( 2000 ) ; PrintWriter pw = new PrintWriter ( sw ) ; NumberFormat nf = NumberFormat . getNumberInstance ( ) ; nf . setMaximumFractionDigits ( 0 ) ; pw . println ( "Treebank has " + numTrees + " trees (" + numTreesLE40 + " of length <= 40) and " + numWords + " words (tokens)" ) ; if ( numTrees > 0 ) { if ( numTags != numWords ) { pw . println ( " Warning! numTags differs and is " + numTags ) ; } if ( roots . size ( ) == 1 ) { String root = ( String ) roots . keySet ( ) . toArray ( ) [ 0 ] ; pw . println ( " The root category is: " + root ) ; } else { pw . println ( " Warning! " + roots . size ( ) + " different roots in treebank: " + Counters . toString ( roots , nf ) ) ; } if ( numNonUnaryRoots > 0 ) { pw . print ( " Warning! " + numNonUnaryRoots + " trees without unary initial rewrite. " ) ; if ( numNonUnaryRoots > 100 ) { pw . print ( "First 100 " ) ; } pw . println ( "Rewrites: " + Counters . toString ( nonUnaries , nf ) ) ; pw . println ( " Example: " + nonUnaryEg ) ; } if ( numUnenclosedLeaves > 0 || numLeaves > 0 || numNonPhrasal > 0 ) { pw . println ( " Warning! Non-phrasal trees: " + numUnenclosedLeaves + " bare leaves; " + numLeaves + " root rewrites as leaf; and " + numNonPhrasal + " root rewrites as tagged word" ) ; if ( numLeaves > 0 ) { pw . println ( " Example bad root rewrites as leaf: " + leafEg ) ; } if ( numNonPhrasal > 0 ) { pw . println ( " Example bad root rewrites as tagged word: " + rootRewritesAsTaggedWordEg ) ; } } if ( numNullLabel > 0 ) { pw . println ( " Warning! " + numNullLabel + " tree nodes with null or empty string labels, e.g.:" ) ; pw . println ( " " + nullLabelEg ) ; } if ( numPreTerminalWithMultipleChildren > 0 ) { pw . println ( " Warning! " + numPreTerminalWithMultipleChildren + " preterminal nodes with multiple children." ) ; pw . println ( " Example: " + preTerminalMultipleChildrenEg ) ; } pw . println ( " Sentences range from " + shortestSentence + " to " + longestSentence + " words, with an average length of " + ( ( ( numWords * 100 ) / numTrees ) / 100.0 ) + " words." ) ; pw . println ( " " + cats . size ( ) + " phrasal category types, " + tags . size ( ) + " tag types, and " + words . size ( ) + " word types" ) ; String [ ] empties = { "*" , "0" , "*T*" , "*RNR*" , "*U*" , "*?*" , "*EXP*" , "*ICH*" , "*NOT*" , "*PPA*" , "*OP*" , "*pro*" , "*PRO*" } ; // What a dopey choice using 0 as an empty element name ! !
// The problem with the below is that words aren ' t turned into a basic
// category , but empties commonly are indexed . . . . Would need to look
// for them with a suffix of - [ 0-9 ] +
Set < String > knownEmpties = new HashSet < String > ( Arrays . asList ( empties ) ) ; Set < String > emptiesIntersection = Sets . intersection ( words , knownEmpties ) ; if ( ! emptiesIntersection . isEmpty ( ) ) { pw . println ( " Caution! " + emptiesIntersection . size ( ) + " word types are known empty elements: " + emptiesIntersection ) ; } Set < String > joint = Sets . intersection ( cats . keySet ( ) , tags . keySet ( ) ) ; if ( ! joint . isEmpty ( ) ) { pw . println ( " Warning! " + joint . size ( ) + " items are tags and categories: " + joint ) ; } for ( String cat : cats . keySet ( ) ) { if ( cat != null && cat . contains ( "@" ) ) { pw . println ( " Warning!! Stanford Parser does not work with categories containing '@' like: " + cat ) ; break ; } } for ( String cat : tags . keySet ( ) ) { if ( cat != null && cat . contains ( "@" ) ) { pw . println ( " Warning!! Stanford Parser does not work with tags containing '@' like: " + cat ) ; break ; } } pw . println ( " Cats: " + Counters . toString ( cats , nf ) ) ; pw . println ( " Tags: " + Counters . toString ( tags , nf ) ) ; pw . println ( " " + starts . size ( ) + " start categories: " + Counters . toString ( starts , nf ) ) ; if ( ! puncts . isEmpty ( ) ) { pw . println ( " Puncts: " + Counters . toString ( puncts , nf ) ) ; } } return sw . toString ( ) ; |
public class SerializerObjectMarshallingStrategy { /** * { @ inheritDoc } */
@ Override public Object unmarshal ( Context context , ObjectInputStream is , byte [ ] object , ClassLoader classloader ) throws IOException , ClassNotFoundException { } } | return _serializer . deserialize ( object , Object . class ) ; |
public class DefaultWhenFileSystem { /** * Returns properties of the file - system being used by the specified { @ code path } , asynchronously .
* @ param path path to anywhere on the filesystem
* @ return a promise for the file system properties */
@ Override public Promise < FileSystemProps > fsProps ( String path ) { } } | return adapter . toPromise ( handler -> vertx . fileSystem ( ) . fsProps ( path , handler ) ) ; |
public class AfplibPackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EClass getIDESize ( ) { } } | if ( ideSizeEClass == null ) { ideSizeEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( AfplibPackage . eNS_URI ) . getEClassifiers ( ) . get ( 389 ) ; } return ideSizeEClass ; |
public class LessLookAheadReader { /** * Skip all data until a newline occur or an EOF
* @ throws LessException if an IO error occur */
void skipLine ( ) { } } | int ch ; do { try { ch = reader . read ( ) ; } catch ( IOException ex ) { throw new LessException ( ex ) ; } incLineColumn ( ch ) ; } while ( ch != '\n' && ch != - 1 ) ; |
public class MoskitoHttpServlet { /** * Override this method to react on http put method . */
protected void moskitoDoPut ( HttpServletRequest req , HttpServletResponse res ) throws ServletException , IOException { } } | super . doPut ( req , res ) ; |
public class NotificationHandlerNodeSubregistry { /** * Get or create a new registry child for the given { @ code elementValue } and traverse it to register the entry . */
void registerEntry ( ListIterator < PathElement > iterator , String elementValue , ConcreteNotificationHandlerRegistration . NotificationHandlerEntry entry ) { } } | final NotificationHandlerNodeRegistry newRegistry = new NotificationHandlerNodeRegistry ( elementValue , this ) ; final NotificationHandlerNodeRegistry existingRegistry = childRegistriesUpdater . putIfAbsent ( this , elementValue , newRegistry ) ; final NotificationHandlerNodeRegistry registry = existingRegistry != null ? existingRegistry : newRegistry ; registry . registerEntry ( iterator , entry ) ; |
public class PoolablePreparedStatement { /** * Method setClob .
* @ param parameterIndex
* @ param x
* @ throws SQLException
* @ see java . sql . PreparedStatement # setClob ( int , Clob ) */
@ Override public void setClob ( int parameterIndex , Clob x ) throws SQLException { } } | internalStmt . setClob ( parameterIndex , x ) ; |
public class AWSElasticBeanstalkClient { /** * Modifies lifecycle settings for an application .
* @ param updateApplicationResourceLifecycleRequest
* @ return Result of the UpdateApplicationResourceLifecycle operation returned by the service .
* @ throws InsufficientPrivilegesException
* The specified account does not have sufficient privileges for one or more AWS services .
* @ sample AWSElasticBeanstalk . UpdateApplicationResourceLifecycle
* @ see < a
* href = " http : / / docs . aws . amazon . com / goto / WebAPI / elasticbeanstalk - 2010-12-01 / UpdateApplicationResourceLifecycle "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public UpdateApplicationResourceLifecycleResult updateApplicationResourceLifecycle ( UpdateApplicationResourceLifecycleRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeUpdateApplicationResourceLifecycle ( request ) ; |
public class HaltonUniformDistribution { /** * Compute the radical inverse of i .
* @ param i Input long value
* @ return Double radical inverse */
private double radicalInverse ( long i ) { } } | double digit = 1.0 / ( double ) base ; double radical = digit ; double inverse = 0.0 ; while ( i > 0 ) { inverse += digit * ( double ) ( i % base ) ; digit *= radical ; i /= base ; } return inverse ; |
public class DataViewMessageBodyWriter { /** * { @ inheritDoc } */
@ Override public boolean isWriteable ( final Class < ? > type , final Type genericType , final Annotation [ ] annotations , final MediaType mediaType ) { } } | String [ ] p ; return ! dataViewDisabled && - 1 != ListUtils . indexOf ( requestProvider . get ( ) . getAcceptableMediaTypes ( ) , this :: isSupportMediaType ) && ( ( p = TemplateHelper . getProduces ( annotations ) ) == null || - 1 != ArrayUtils . indexOf ( p , ( Predicate < String > ) stringType -> { if ( stringType . equals ( MediaType . WILDCARD ) ) return true ; MediaType mediaType1 = MediaType . valueOf ( stringType ) ; return isSupportMediaType ( mediaType1 ) ; } ) ) ; |
public class SipNetworkInterfaceManagerImpl { /** * If the host is Ipv6 , get the host without " [ " and " ] "
* If the host is Ipv4 , get the host as normal .
* @ param host
* @ return host without square brackets */
private String extractIPV6Brackets ( String host ) { } } | String ret = host ; // IPv6 here , remove square brackets
if ( host . indexOf ( ':' ) != - 1 ) { int startPoint = host . indexOf ( '[' ) ; int endPoint = host . indexOf ( ']' ) ; if ( endPoint == - 1 ) endPoint = host . length ( ) ; if ( startPoint != - 1 ) { ret = host . substring ( startPoint + 1 , endPoint ) ; } else { ret = host . substring ( 0 , endPoint ) ; } } return ret ; |
public class ST_MakeLine { /** * Constructs a LINESTRING from the given POINTs or MULTIPOINTs
* @ param pointA The first POINT or MULTIPOINT
* @ param optionalPoints Optional POINTs or MULTIPOINTs
* @ return The LINESTRING constructed from the given POINTs or MULTIPOINTs
* @ throws SQLException */
public static LineString createLine ( Geometry pointA , Geometry ... optionalPoints ) throws SQLException { } } | if ( pointA == null || optionalPoints . length > 0 && optionalPoints [ 0 ] == null ) { return null ; } if ( pointA . getNumGeometries ( ) == 1 && ! atLeastTwoPoints ( optionalPoints , countPoints ( pointA ) ) ) { throw new SQLException ( "At least two points are required to make a line." ) ; } List < Coordinate > coordinateList = new LinkedList < Coordinate > ( ) ; addCoordinatesToList ( pointA , coordinateList ) ; for ( Geometry optionalPoint : optionalPoints ) { addCoordinatesToList ( optionalPoint , coordinateList ) ; } return ( ( Geometry ) pointA ) . getFactory ( ) . createLineString ( coordinateList . toArray ( new Coordinate [ optionalPoints . length ] ) ) ; |
public class Radar { /** * Adds a new point of interest to the list of poi ' s of the radar
* Keep in mind that only the poi ' s are visible as blips that are
* in the range of the radar .
* @ param BLIP */
public void addPoi ( final Poi BLIP ) { } } | if ( pois . keySet ( ) . contains ( BLIP . getName ( ) ) ) { updatePoi ( BLIP . getName ( ) , BLIP . getLocation ( ) ) ; } else { pois . put ( BLIP . getName ( ) , BLIP ) ; } checkForBlips ( ) ; |
public class AbstractPojoPathNavigator { /** * This method gets the value for the single { @ link CachingPojoPath # getSegment ( ) segment } of the given
* { @ code currentPath } from the { @ link CachingPojoPath # getPojo ( ) pojo } of its { @ link CachingPojoPath # getParent ( )
* parent } . < br >
* If the { @ code state } { @ link PojoPathState # isGetType ( ) indicates } an invocation from
* { @ link # getType ( GenericType , String , boolean , PojoPathContext ) getType } , only the
* { @ link CachingPojoPath # setPojoType ( GenericType ) pojo - type } should be determined . Otherwise if the result is
* { @ code null } and { @ link PojoPathState # getMode ( ) mode } is { @ link PojoPathMode # CREATE _ IF _ NULL } it creates and
* attaches ( sets ) the missing object .
* @ param currentPath is the current { @ link CachingPojoPath } to evaluate .
* @ param context is the { @ link PojoPathContext context } for this operation .
* @ param state is the { @ link # createState ( Object , String , PojoPathMode , PojoPathContext ) cache } to use or
* { @ code null } to disable caching .
* @ return the result of the evaluation of the given { @ code pojoPath } starting at the given { @ code pojo } . It may be
* { @ code null } according to the given { @ link PojoPathMode mode } . */
@ SuppressWarnings ( { } } | "unchecked" , "rawtypes" } ) protected Object get ( CachingPojoPath currentPath , PojoPathContext context , PojoPathState state ) { Object result ; String functionName = currentPath . getFunction ( ) ; if ( functionName != null ) { // current segment is a function . . .
PojoPathFunction function = getFunction ( functionName , context ) ; if ( state . isGetType ( ) ) { result = null ; currentPath . pojoType = new SimpleGenericTypeImpl ( function . getValueClass ( ) ) ; } else { result = getFromFunction ( currentPath , context , state , function ) ; } } else { Object parentPojo = currentPath . parent . pojo ; // current segment is NOT a function
if ( ( parentPojo instanceof Map ) || ( state . isGetType ( ) && Map . class . isAssignableFrom ( currentPath . parent . pojoClass ) ) ) { result = getFromMap ( currentPath , context , state , ( Map ) parentPojo ) ; } else { Integer index = currentPath . getIndex ( ) ; if ( index != null ) { // handle indexed segment for list or array . . .
result = getFromList ( currentPath , context , state , index . intValue ( ) ) ; } else { // in all other cases get via reflection from POJO . . .
result = getFromPojo ( currentPath , context , state ) ; } } } if ( result != null ) { Class < ? > resultType = result . getClass ( ) ; if ( currentPath . pojoType == null ) { currentPath . pojoType = new SimpleGenericTypeImpl ( resultType ) ; } if ( currentPath . pojoClass != resultType ) { currentPath . pojoClass = resultType ; } } return result ; |
public class Ifc4FactoryImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public String convertIfcConstructionEquipmentResourceTypeEnumToString ( EDataType eDataType , Object instanceValue ) { } } | return instanceValue == null ? null : instanceValue . toString ( ) ; |
public class TwitterEndpointServices { /** * Invokes the { @ value TwitterConstants # TWITTER _ ENDPOINT _ VERIFY _ CREDENTIALS } endpoint in order to obtain a value to use for
* the user subject .
* @ param config
* @ param accessToken
* @ param accessTokenSecret
* @ return */
public Map < String , Object > verifyCredentials ( SocialLoginConfig config , String accessToken , @ Sensitive String accessTokenSecret ) { } } | String endpointUrl = config . getUserApi ( ) ; try { SocialUtil . validateEndpointWithQuery ( endpointUrl ) ; } catch ( SocialLoginException e ) { return createErrorResponse ( "TWITTER_BAD_USER_API_URL" , new Object [ ] { endpointUrl , TwitterLoginConfigImpl . KEY_userApi , config . getUniqueId ( ) , e . getLocalizedMessage ( ) } ) ; } tokenSecret = accessTokenSecret ; requestMethod = "GET" ; // Create the Authorization header string necessary to authenticate the request
String authzHeaderString = createAuthzHeaderForVerifyCredentialsEndpoint ( endpointUrl , accessToken ) ; if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Authz header string: " + authzHeaderString ) ; } return executeRequest ( config , requestMethod , authzHeaderString , endpointUrl , TwitterConstants . TWITTER_ENDPOINT_VERIFY_CREDENTIALS , null ) ; |
public class Expressions { /** * Create a new EnumExpression
* @ param value enum
* @ return new EnumExpression */
public static < T extends Enum < T > > EnumExpression < T > asEnum ( T value ) { } } | return asEnum ( constant ( value ) ) ; |
public class SchemasInner { /** * Creates or updates an integration account schema .
* @ param resourceGroupName The resource group name .
* @ param integrationAccountName The integration account name .
* @ param schemaName The integration account schema name .
* @ param schema The integration account schema .
* @ 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 IntegrationAccountSchemaInner object if successful . */
public IntegrationAccountSchemaInner createOrUpdate ( String resourceGroupName , String integrationAccountName , String schemaName , IntegrationAccountSchemaInner schema ) { } } | return createOrUpdateWithServiceResponseAsync ( resourceGroupName , integrationAccountName , schemaName , schema ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class JCusolverSp { /** * < pre >
* - - - - - GPU linear solver by QR factorization
* solve A * x = b , A can be singular
* [ ls ] stands for linear solve
* [ v ] stands for vector
* [ qr ] stands for QR factorization
* < / pre > */
public static int cusolverSpScsrlsvqr ( cusolverSpHandle handle , int m , int nnz , cusparseMatDescr descrA , Pointer csrVal , Pointer csrRowPtr , Pointer csrColInd , Pointer b , float tol , int reorder , Pointer x , int [ ] singularity ) { } } | return checkResult ( cusolverSpScsrlsvqrNative ( handle , m , nnz , descrA , csrVal , csrRowPtr , csrColInd , b , tol , reorder , x , singularity ) ) ; |
public class MatrixFactory { /** * Creates and initializes a new 3D column vector .
* @ param x the x coordinate of the new vector
* @ param y the y coordinate of the new vector
* @ param z the z coordinate of the new vector
* @ return the new vector */
public static Vector3 createVector ( double x , double y , double z ) { } } | Vector3 v = new Vector3Impl ( ) ; v . setX ( x ) ; v . setY ( y ) ; v . setZ ( z ) ; return v ; |
public class Projection { /** * / / CLAUSES / / / / */
public Clause field ( String field , Object value ) { } } | return new CustomFormatClause ( Operator . FIELD , this , field , cast ( value ) ) ; |
public class EventHandler { /** * Triggers a state transition event to @ newState with an identifier
* ( eg , requestId , jobUUID , etc )
* @ param newState new state
* @ param identifier event id */
void triggerStateTransition ( BasicEvent . QueryState newState , String identifier ) { } } | String msg = "{newState: " + newState . getDescription ( ) + ", " + "info: " + identifier + ", " + "timestamp: " + getCurrentTimestamp ( ) + "}" ; Event triggeredEvent = new BasicEvent ( Event . EventType . STATE_TRANSITION , msg ) ; pushEvent ( triggeredEvent , false ) ; |
public class CPOptionCategoryLocalServiceBaseImpl { /** * Returns all the cp option categories matching the UUID and company .
* @ param uuid the UUID of the cp option categories
* @ param companyId the primary key of the company
* @ return the matching cp option categories , or an empty list if no matches were found */
@ Override public List < CPOptionCategory > getCPOptionCategoriesByUuidAndCompanyId ( String uuid , long companyId ) { } } | return cpOptionCategoryPersistence . findByUuid_C ( uuid , companyId ) ; |
public class DoradusServer { /** * Start the Doradus Server in stand - alone mode , overriding doradus . yaml file options
* with the given options . All required services plus default _ services and
* storage _ services configured in doradus . yaml are started . The process blocks until a
* shutdown signal is received via Ctrl - C or until { @ link # shutdown ( String [ ] ) } is
* called .
* @ param args Optional arguments that override doradus . yaml file options . Arguments
* should be provided in the form " - option value " where " option " is a
* doradus . yaml option name and " value " is the overriding value . For
* example : " - restport 1223 " sets the REST API listening port to 1223. */
public static void main ( String [ ] args ) { } } | try { instance ( ) . initStandAlone ( args ) ; instance ( ) . start ( ) ; instance ( ) . waitForShutdown ( ) ; } catch ( Throwable e ) { instance ( ) . m_logger . error ( "Abnormal shutdown" , e ) ; System . exit ( 1 ) ; // invokes shutdown hooks
} |
public class ProofObligation { /** * Create a multiple type bind with a varargs list of pattern variables , like a , b , c : T . This is used by several
* obligations . */
protected PMultipleBind getMultipleTypeBind ( PType patternType , ILexNameToken ... patternNames ) { } } | ATypeMultipleBind typeBind = new ATypeMultipleBind ( ) ; List < PPattern > patternList = new Vector < PPattern > ( ) ; for ( ILexNameToken patternName : patternNames ) { AIdentifierPattern pattern = new AIdentifierPattern ( ) ; pattern . setName ( patternName . clone ( ) ) ; patternList . add ( pattern ) ; } typeBind . setPlist ( patternList ) ; typeBind . setType ( patternType . clone ( ) ) ; return typeBind ; |
public class AbstractContext { /** * Destroy the Contextual Instance of the given Bean .
* @ param bean dictates which bean shall get cleaned up
* @ return < code > true < / code > if the bean was destroyed , < code > false < / code > if there was no such bean . */
public boolean destroy ( Contextual bean ) { } } | ContextualStorage storage = getContextualStorage ( false ) ; if ( storage == null ) { return false ; } ContextualInstanceInfo < ? > contextualInstanceInfo = storage . getStorage ( ) . get ( storage . getBeanKey ( bean ) ) ; if ( contextualInstanceInfo == null ) { return false ; } bean . destroy ( contextualInstanceInfo . getContextualInstance ( ) , contextualInstanceInfo . getCreationalContext ( ) ) ; return true ; |
public class AgentOutput { /** * Write bytes to an { @ link OutputStream } and prepend with four bytes indicating their length .
* @ param out { @ link OutputStream }
* @ param bytes Array of bytes . */
private static void writeField ( final OutputStream out , final byte [ ] bytes ) throws IOException { } } | // All protocol messages are prefixed with their length in bytes , encoded
// as a 32 bit unsigned integer .
final ByteBuffer buffer = ByteBuffer . allocate ( INT_BYTES + bytes . length ) ; buffer . putInt ( bytes . length ) ; buffer . put ( bytes ) ; out . write ( buffer . array ( ) ) ; out . flush ( ) ; |
public class IOUtils { /** * Copy the input stream to the output stream */
public static void copyStream ( OutputStream outs , InputStream ins ) throws IOException { } } | try { byte [ ] bytes = new byte [ 1024 ] ; int r = ins . read ( bytes ) ; while ( r > 0 ) { outs . write ( bytes , 0 , r ) ; r = ins . read ( bytes ) ; } } catch ( IOException e ) { throw e ; } finally { ins . close ( ) ; } |
public class HttpMessage { /** * Gets the Http response status code .
* @ return The status code of the message */
public HttpStatus getStatusCode ( ) { } } | final Object statusCode = getHeader ( HttpMessageHeaders . HTTP_STATUS_CODE ) ; if ( statusCode != null ) { if ( statusCode instanceof HttpStatus ) { return ( HttpStatus ) statusCode ; } else if ( statusCode instanceof Integer ) { return HttpStatus . valueOf ( ( Integer ) statusCode ) ; } else { return HttpStatus . valueOf ( Integer . valueOf ( statusCode . toString ( ) ) ) ; } } return null ; |
public class ResponderTask { /** * Set up a chained ResponderTask , where the new instance will use the same input / output streams and buffers .
* However they must both be invoked individually , use { @ link # createSequence ( Responder ,
* ResponderTask . ResultHandler ) } to set up a sequential invocation of
* another responder . */
private ResponderTask chainResponder ( final Responder responder , final ResultHandler resultHandler ) { } } | return new ResponderTask ( responder , reader , outputStream , resultHandler , partialLineBuffer ) ; |
public class XNElement { /** * Save the tree into the given XML stream writer .
* @ param stream the stream writer
* @ throws XMLStreamException if an error occurs */
public void save ( XMLStreamWriter stream ) throws XMLStreamException { } } | stream . writeStartDocument ( "UTF-8" , "1.0" ) ; saveInternal ( stream ) ; stream . writeEndDocument ( ) ; |
public class CompleteWorkflowExecutionFailedEventAttributesMarshaller { /** * Marshall the given parameter object . */
public void marshall ( CompleteWorkflowExecutionFailedEventAttributes completeWorkflowExecutionFailedEventAttributes , ProtocolMarshaller protocolMarshaller ) { } } | if ( completeWorkflowExecutionFailedEventAttributes == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( completeWorkflowExecutionFailedEventAttributes . getCause ( ) , CAUSE_BINDING ) ; protocolMarshaller . marshall ( completeWorkflowExecutionFailedEventAttributes . getDecisionTaskCompletedEventId ( ) , DECISIONTASKCOMPLETEDEVENTID_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class DocumentBuilderFactory { /** * < p > Set the { @ link Schema } to be used by parsers created
* from this factory .
* When a { @ link Schema } is non - null , a parser will use a validator
* created from it to validate documents before it passes information
* down to the application .
* < p > When errors are found by the validator , the parser is responsible
* to report them to the user - specified { @ link org . xml . sax . ErrorHandler }
* ( or if the error handler is not set , ignore them or throw them ) , just
* like any other errors found by the parser itself .
* In other words , if the user - specified { @ link org . xml . sax . ErrorHandler }
* is set , it must receive those errors , and if not , they must be
* treated according to the implementation specific
* default error handling rules .
* A validator may modify the outcome of a parse ( for example by
* adding default values that were missing in documents ) , and a parser
* is responsible to make sure that the application will receive
* modified DOM trees .
* Initially , null is set as the { @ link Schema } .
* This processing will take effect even if
* the { @ link # isValidating ( ) } method returns < tt > false < / tt > .
* < p > It is an error to use
* the < code > http : / / java . sun . com / xml / jaxp / properties / schemaSource < / code >
* property and / or the < code > http : / / java . sun . com / xml / jaxp / properties / schemaLanguage < / code >
* property in conjunction with a { @ link Schema } object .
* Such configuration will cause a { @ link ParserConfigurationException }
* exception when the { @ link # newDocumentBuilder ( ) } is invoked . < / p >
* < h4 > Note for implementors < / h4 >
* A parser must be able to work with any { @ link Schema }
* implementation . However , parsers and schemas are allowed
* to use implementation - specific custom mechanisms
* as long as they yield the result described in the specification .
* @ param schema < code > Schema < / code > to use or < code > null < / code > to remove a schema .
* @ throws UnsupportedOperationException
* For backward compatibility , when implementations for
* earlier versions of JAXP is used , this exception will be
* thrown .
* @ since 1.5 */
public void setSchema ( Schema schema ) { } } | throw new UnsupportedOperationException ( "This parser does not support specification \"" + this . getClass ( ) . getPackage ( ) . getSpecificationTitle ( ) + "\" version \"" + this . getClass ( ) . getPackage ( ) . getSpecificationVersion ( ) + "\"" ) ; |
public class S3ObjectWriter { /** * Non - blocking call that will throw any Exceptions in the traditional
* manner on access
* @ param key
* @ param value
* @ return */
public Eval < UploadResult > putAsync ( String key , Object value ) { } } | return Eval . later ( ( ) -> put ( key , value ) ) . map ( t -> t . orElse ( null ) ) . map ( FluentFunctions . ofChecked ( up -> up . waitForUploadResult ( ) ) ) ; |
public class FileUtils { /** * Creates a file system directory with the given { @ link File } path .
* @ param path the given { @ link File } indicating the file system path of the directory to create .
* @ return true if the path represented by the { @ link File } object is not null , is not an existing file ,
* or the path can be created as a directory if it does not already exist . Returns true if the directory
* already exists .
* @ see java . io . File # mkdirs ( ) */
@ NullSafe public static boolean createDirectory ( File path ) { } } | return ( path != null && ! path . isFile ( ) && ( path . isDirectory ( ) || path . mkdirs ( ) ) ) ; |
public class PluralCodeGenerator { /** * Builds a method that when called evaluates the rule and returns a PluralCategory . */
private MethodSpec buildRuleMethod ( String methodName , PluralData data , Map < String , FieldSpec > fieldMap ) { } } | MethodSpec . Builder method = MethodSpec . methodBuilder ( methodName ) . addModifiers ( PRIVATE , STATIC ) . addParameter ( NUMBER_OPERANDS , "o" ) . returns ( PLURAL_CATEGORY ) ; for ( Map . Entry < String , PluralData . Rule > entry : data . rules ( ) . entrySet ( ) ) { String category = entry . getKey ( ) ; // Other is always the last condition in a set of rules .
if ( category . equals ( "other" ) ) { // Last condition .
method . addStatement ( "return PluralCategory.OTHER" ) ; break ; } // Create a representation of the full rule for commenting .
PluralData . Rule rule = entry . getValue ( ) ; String ruleRepr = PluralRulePrinter . print ( rule . condition ) ; // Append all of the lambda methods we ' ll be invoking to evaluate this rule .
List < String > fields = new ArrayList < > ( ) ; for ( Node < PluralType > condition : rule . condition . asStruct ( ) . nodes ( ) ) { String repr = PluralRulePrinter . print ( condition ) ; fields . add ( fieldMap . get ( repr ) . name ) ; } // Header comment to indicate which conditions are evaluated .
method . addComment ( " $L" , ruleRepr ) ; if ( ! Objects . equals ( rule . sample , "" ) ) { List < String > samples = Splitter . on ( "@" ) . splitToList ( rule . sample ) ; for ( String sample : samples ) { method . addComment ( " $L" , sample ) ; } } // Emit the chain of OR conditions . If one is true we return the current category .
int size = fields . size ( ) ; String stmt = "if (" ; for ( int i = 0 ; i < size ; i ++ ) { if ( i > 0 ) { stmt += " || " ; } stmt += fields . get ( i ) + ".eval(o)" ; } stmt += ")" ; // If the rule evaluates to true , return the associated plural category .
method . beginControlFlow ( stmt ) ; method . addStatement ( "return PluralCategory." + category . toUpperCase ( ) ) ; method . endControlFlow ( ) ; method . addCode ( "\n" ) ; } return method . build ( ) ; |
public class ExpirationManagerImpl { /** * Deletes the key from the store as well as notifies the cache listeners of the expiration of the given key ,
* value , metadata combination .
* This method must be invoked while holding data container lock for the given key to ensure events are ordered
* properly .
* @ param key
* @ param value
* @ param metadata */
private void deleteFromStoresAndNotify ( K key , V value , Metadata metadata ) { } } | deleteFromStores ( key ) ; CompletionStages . join ( cacheNotifier . notifyCacheEntryExpired ( key , value , metadata , null ) ) ; |
public class Points { /** * Returns the Manhattan distance between the specified two points . */
public static int manhattanDistance ( int x1 , int y1 , int x2 , int y2 ) { } } | return Math . abs ( x2 - x1 ) + Math . abs ( y2 - y1 ) ; |
public class DeviceImpl { /** * Get device description .
* It ' s the master method executed when the device description is requested
* via a CORBA attribute . It updates the device black - box and return the
* device description field
* @ return The device description */
public String description ( ) { } } | Util . out4 . println ( "DeviceImpl.description() arrived" ) ; // Record attribute request in black box
blackbox . insert_attr ( Attr_Description ) ; // Return data to caller
Util . out4 . println ( "Leaving DeviceImpl.description()" ) ; return desc ; |
public class SRTCPCryptoContext { /** * Derive a new SRTPCryptoContext for use with a new SSRC
* This method returns a new SRTPCryptoContext initialized with the data of
* this SRTPCryptoContext . Replacing the SSRC , Roll - over - Counter , and the
* key derivation rate the application cab use this SRTPCryptoContext to
* encrypt / decrypt a new stream ( Synchronization source ) inside one RTP
* session .
* Before the application can use this SRTPCryptoContext it must call the
* deriveSrtpKeys method .
* @ param ssrc
* The SSRC for this context
* @ return a new SRTPCryptoContext with all relevant data set . */
public SRTCPCryptoContext deriveContext ( long ssrc ) { } } | SRTCPCryptoContext pcc = null ; pcc = new SRTCPCryptoContext ( ssrc , masterKey , masterSalt , policy ) ; return pcc ; |
public class XMLSerializer { /** * Creates a JSON value from a File .
* @ param path
* @ return a JSONNull , JSONObject or JSONArray
* @ throws JSONException if the conversion from XML to JSON can ' t be made for
* I / O or format reasons . */
public JSON readFromFile ( String path ) { } } | return readFromStream ( Thread . currentThread ( ) . getContextClassLoader ( ) . getResourceAsStream ( path ) ) ; |
public class GeneralFactory { /** * 获取ThriftServer对象 */
@ Override public ThriftServer getThriftServer ( String serverName , int serverPort , TProcessor processor ) { } } | return new ThreadPoolThriftServerImpl ( serverName , serverPort , thriftServerConfiguration , processor ) ; |
public class BoxFactory { /** * Create the viewport and the underlying box tree from a DOM tree .
* @ param root the root element of the source DOM tree .
* @ param g the root graphic context . Copies of this context will be used for the individual boxes .
* @ param ctx the visual context ( computed style ) . Copies of this context will be used for the individual boxes .
* @ param width preferred viewport width .
* @ param height preferred viewport height .
* @ return the created viewport box with the corresponding box subtrees . */
public Viewport createViewportTree ( Element root , Graphics2D g , VisualContext ctx , int width , int height ) { } } | Element vp = createAnonymousElement ( root . getOwnerDocument ( ) , "Xdiv" , "block" ) ; viewport = new Viewport ( vp , g , ctx , this , root , width , height ) ; viewport . setConfig ( config ) ; overflowPropagated = false ; BoxTreeCreationStatus stat = new BoxTreeCreationStatus ( viewport ) ; createSubtree ( root , stat ) ; log . debug ( "Root box is: " + viewport . getRootBox ( ) ) ; return viewport ; |
public class Util { /** * Create a { @ link io . kickflip . sdk . av . SessionConfig }
* corresponding to a 420p video stream
* @ param context the host application Context . Used to access Internal Storage
* @ return the resulting SessionConfig */
public static SessionConfig create420pSessionConfig ( Context context , String targer ) { } } | String outputPath = new File ( context . getFilesDir ( ) , "index.m3u8" ) . getAbsolutePath ( ) ; SessionConfig config = new SessionConfig . Builder ( outputPath ) . withTitle ( Util . getHumanDateString ( ) ) . withVideoBitrate ( 1 * 1000 * 1000 ) . withPrivateVisibility ( false ) . withLocation ( true ) . withVideoResolution ( 720 , 480 ) . build ( ) ; return config ; |
public class Tools { /** * Set dialog location to the center of the screen
* @ param dialog the dialog which will be centered
* @ since 2.6 */
public static void centerDialog ( JDialog dialog ) { } } | Dimension screenSize = Toolkit . getDefaultToolkit ( ) . getScreenSize ( ) ; Dimension frameSize = dialog . getSize ( ) ; dialog . setLocation ( screenSize . width / 2 - frameSize . width / 2 , screenSize . height / 2 - frameSize . height / 2 ) ; dialog . setLocationByPlatform ( true ) ; |
public class HazelcastInstanceFactory { /** * Creates a new Hazelcast instance .
* @ param config the configuration to use ; if < code > null < / code > , the set of defaults
* as specified in the XSD for the configuration XML will be used .
* @ param instanceName the name of the { @ link HazelcastInstance }
* @ param nodeContext the { @ link NodeContext } to use
* @ return the configured { @ link HazelcastInstance } */
public static HazelcastInstance newHazelcastInstance ( Config config , String instanceName , NodeContext nodeContext ) { } } | if ( config == null ) { config = new XmlConfigBuilder ( ) . build ( ) ; } String name = getInstanceName ( instanceName , config ) ; InstanceFuture future = new InstanceFuture ( ) ; if ( INSTANCE_MAP . putIfAbsent ( name , future ) != null ) { throw new DuplicateInstanceNameException ( "HazelcastInstance with name '" + name + "' already exists!" ) ; } try { return constructHazelcastInstance ( config , name , nodeContext , future ) ; } catch ( Throwable t ) { INSTANCE_MAP . remove ( name , future ) ; future . setFailure ( t ) ; throw ExceptionUtil . rethrow ( t ) ; } |
public class Redisson { /** * Create Reactive Redisson instance with provided config
* @ param config for Redisson
* @ return Redisson instance */
public static RedissonReactiveClient createReactive ( Config config ) { } } | RedissonReactive react = new RedissonReactive ( config ) ; if ( config . isReferenceEnabled ( ) ) { react . enableRedissonReferenceSupport ( ) ; } return react ; |
public class Polygon { /** * Check the exterior ring and all interior rings for validity . Also checks to see if there are no intersections
* between any of the rings ( both exterior and interior ) . */
public boolean isValid ( ) { } } | if ( isEmpty ( ) ) { return true ; } if ( ! exteriorRing . isValid ( ) ) { return false ; } if ( interiorRings != null ) { LinearRing ring1 ; LinearRing ring2 ; for ( int i = 0 ; i <= interiorRings . length ; i ++ ) { if ( i == interiorRings . length ) { ring1 = exteriorRing ; } else { ring1 = interiorRings [ i ] ; if ( ! ring1 . isValid ( ) ) { return false ; } } for ( int j = 0 ; j <= interiorRings . length ; j ++ ) { if ( i == j ) { continue ; } if ( j == interiorRings . length ) { ring2 = exteriorRing ; } else { ring2 = interiorRings [ j ] ; } if ( ring1 . intersects ( ring2 ) ) { return false ; } } } } return true ; |
public class SwaggerBuilder { /** * Registers a ControllerHandler as a Swagger Operation .
* If the path for the operation is unrecognized , a new Swagger Path is created .
* @ param swagger
* @ param route
* @ param handler */
protected void registerOperation ( Swagger swagger , Route route , ControllerHandler handler ) { } } | Class < ? extends Controller > controller = handler . getControllerClass ( ) ; Method method = handler . getControllerMethod ( ) ; List < String > accepts = ControllerUtil . cleanupFuzzyContentTypes ( handler . getDeclaredConsumes ( ) ) ; List < String > produces = handler . getDeclaredProduces ( ) ; Operation operation = new Operation ( ) ; if ( method . isAnnotationPresent ( ApiSummary . class ) ) { ApiSummary apiSummary = method . getAnnotation ( ApiSummary . class ) ; String summary = translate ( apiSummary . key ( ) , apiSummary . value ( ) ) ; if ( Strings . isNullOrEmpty ( summary ) ) { operation . setSummary ( Util . toString ( method ) ) ; } else { operation . setSummary ( summary ) ; } } else if ( Strings . isNullOrEmpty ( route . getName ( ) ) ) { operation . setSummary ( Util . toString ( method ) ) ; } else { operation . setSummary ( route . getName ( ) ) ; } if ( operation . getSummary ( ) . length ( ) > 120 ) { log . warn ( "'{}' api summary exceeds 120 characters" , Util . toString ( method ) ) ; } StringBuilder sb = new StringBuilder ( ) ; String notes = getNotes ( method ) ; if ( ! Strings . isNullOrEmpty ( notes ) ) { sb . append ( notes ) ; } operation . setOperationId ( Util . toString ( method ) ) ; operation . setConsumes ( accepts . isEmpty ( ) ? produces : accepts ) ; operation . setProduces ( produces ) ; operation . setDeprecated ( method . isAnnotationPresent ( Deprecated . class ) || controller . isAnnotationPresent ( Deprecated . class ) ) ; registerResponses ( swagger , operation , method ) ; registerSecurity ( swagger , operation , method ) ; Tag tag = getControllerTag ( controller ) ; if ( tag == null ) { operation . addTag ( controller . getSimpleName ( ) ) ; } else { swagger . addTag ( tag ) ; operation . addTag ( tag . getName ( ) ) ; } // identify and extract suffixes to automatically document those
String operationPath = StringUtils . removeStart ( registerParameters ( swagger , operation , route , method ) , swagger . getBasePath ( ) ) ; operationPath = stripContentTypeSuffixPattern ( operationPath ) ; Matcher suffixesMatcher = PATTERN_FOR_CONTENT_TYPE_SUFFIX . matcher ( route . getUriPattern ( ) ) ; boolean suffixRequired = false ; List < String > suffixes = new ArrayList < > ( ) ; while ( suffixesMatcher . find ( ) ) { String suffixExpression = suffixesMatcher . group ( 1 ) ; suffixRequired = suffixExpression . charAt ( suffixExpression . length ( ) - 1 ) != '?' ; Matcher suffixMatcher = PATTERN_FOR_SUFFIX_EXTRACTION . matcher ( suffixExpression ) ; while ( suffixMatcher . find ( ) ) { String suffix = suffixMatcher . group ( 1 ) ; suffixes . add ( suffix ) ; } } if ( ! suffixes . isEmpty ( ) ) { sb . append ( "\n\n" ) ; sb . append ( "#### " ) ; String header = "Content-Type Suffixes" ; if ( messages != null ) { header = messages . getWithDefault ( "swagger.contentTypeSuffixHeader" , header , "" ) ; } sb . append ( header ) ; sb . append ( "\n\n" ) ; if ( suffixRequired ) { String message = "A Content-Type suffix is **required**." ; if ( messages != null ) { message = messages . getWithDefault ( "swagger.contentTypeSuffixRequired" , message , "" ) ; } sb . append ( message ) ; } else { String message = "A Content-Type suffix is *optional*." ; if ( messages != null ) { message = messages . getWithDefault ( "swagger.contentTypeSuffixOptional" , message , "" ) ; } sb . append ( message ) ; } sb . append ( "\n\n" ) ; sb . append ( "| Content-Type | URI |\n" ) ; sb . append ( "|--------------|---------|\n" ) ; if ( ! suffixRequired ) { sb . append ( "| " ) . append ( produces . size ( ) > 1 ? "**negotiated**" : produces . get ( 0 ) ) . append ( " " ) ; sb . append ( "| " ) . append ( operationPath ) . append ( " " ) ; sb . append ( "|\n" ) ; } for ( String suffix : suffixes ) { String contentType = engines == null ? "???" : engines . getContentTypeEngine ( suffix ) . getContentType ( ) ; sb . append ( "| " ) . append ( contentType ) . append ( " " ) ; sb . append ( "| " ) . append ( operationPath ) . append ( '.' ) . append ( suffix ) . append ( " " ) ; sb . append ( "|\n" ) ; } sb . append ( '\n' ) ; } if ( sb . length ( ) > 0 ) { operation . setDescription ( sb . toString ( ) ) ; } if ( swagger . getPath ( operationPath ) == null ) { swagger . path ( operationPath , new Path ( ) ) ; } Path path = swagger . getPath ( operationPath ) ; path . set ( route . getRequestMethod ( ) . toLowerCase ( ) , operation ) ; log . debug ( "Add {} {} => {}" , route . getRequestMethod ( ) , operationPath , Util . toString ( method ) ) ; |
public class CmsToolManager { /** * Redirects to the given page with the given parameters . < p >
* @ param wp the workplace object
* @ param pagePath the path to the page to redirect to
* @ param params the parameters to send
* @ throws IOException in case of errors during forwarding
* @ throws ServletException in case of errors during forwarding */
public void jspForwardPage ( CmsWorkplace wp , String pagePath , Map < String , String [ ] > params ) throws IOException , ServletException { } } | Map < String , String [ ] > newParams = createToolParams ( wp , pagePath , params ) ; if ( pagePath . indexOf ( "?" ) > 0 ) { pagePath = pagePath . substring ( 0 , pagePath . indexOf ( "?" ) ) ; } wp . setForwarded ( true ) ; // forward to the requested page uri
CmsRequestUtil . forwardRequest ( wp . getJsp ( ) . link ( pagePath ) , CmsRequestUtil . createParameterMap ( newParams ) , wp . getJsp ( ) . getRequest ( ) , wp . getJsp ( ) . getResponse ( ) ) ; |
public class SendDocument { /** * Use this method to set the document to a new file
* @ param file New document file */
public SendDocument setDocument ( File file ) { } } | Objects . requireNonNull ( file , "documentName cannot be null!" ) ; this . document = new InputFile ( file , file . getName ( ) ) ; return this ; |
public class AuthResourceRepresentation { /** * Creates a resource representation for use in authorization of actions pertaining to the specified stream within
* the specified scope .
* @ param scopeName the name of the scope
* @ param streamName the name of the stream
* @ return a string representing the specified stream within the specified scope
* @ throws NullPointerException if { @ code scopeName } or { @ code streamName } are null
* @ throws IllegalArgumentException if { @ code scopeName } or { @ code streamName } are empty */
public static String ofStreamInScope ( String scopeName , String streamName ) { } } | Exceptions . checkNotNullOrEmpty ( streamName , "streamName" ) ; return String . format ( "%s/%s" , ofStreamsInScope ( scopeName ) , streamName ) ; |
public class Matrix { /** * Powers this matrix of given exponent { code n } .
* @ param n the exponent
* @ return the powered matrix */
public Matrix power ( int n ) { } } | if ( n < 0 ) { fail ( "The exponent should be positive: " + n + "." ) ; } Matrix result = blankOfShape ( rows , rows ) ; Matrix that = this ; for ( int i = 0 ; i < rows ; i ++ ) { result . set ( i , i , 1.0 ) ; } while ( n > 0 ) { if ( n % 2 == 1 ) { result = result . multiply ( that ) ; } n /= 2 ; that = that . multiply ( that ) ; } return result ; |
public class Matrix4 { /** * Sets this to a perspective projection matrix . The formula comes from the OpenGL
* documentation for the glFrustum function .
* @ return a reference to this matrix , for chaining . */
public Matrix4 setToFrustum ( double left , double right , double bottom , double top , double near , double far ) { } } | return setToFrustum ( left , right , bottom , top , near , far , Vector3 . UNIT_Z ) ; |
public class CmsHtmlConverterJTidy { /** * Parses a byte array containing HTML code with different parsing modes . < p >
* @ param htmlInput a byte array containing raw HTML code
* @ return parsed and cleared HTML code
* @ throws UnsupportedEncodingException if the encoding set for the conversion is not supported */
private String parse ( String htmlInput ) throws UnsupportedEncodingException { } } | // prepare the streams
ByteArrayInputStream in = new ByteArrayInputStream ( htmlInput . getBytes ( getEncoding ( ) ) ) ; ByteArrayOutputStream out = new ByteArrayOutputStream ( ) ; // do the parsing
m_tidy . parse ( in , out ) ; // return the result
byte [ ] result = out . toByteArray ( ) ; return new String ( result , getEncoding ( ) ) ; |
public class PredicateFilterAxis { /** * { @ inheritDoc } */
@ Override public final boolean hasNext ( ) { } } | resetToLastKey ( ) ; // a predicate has to evaluate to true only once .
if ( mIsFirst ) { mIsFirst = false ; if ( mPredicate . hasNext ( ) ) { if ( isBooleanFalse ( ) ) { resetToStartKey ( ) ; return false ; } // reset is needed , because a predicate works more like a
// filter . It
// does
// not change the current transaction .
resetToLastKey ( ) ; return true ; } } resetToStartKey ( ) ; return false ; |
public class ReflectionsHelper { /** * OSX contains file : / / resources on the classpath including . mar and . jnilib files .
* Reflections use of Vfs doesn ' t recognize these URLs and logs warns when it sees them . By registering those file endings , we supress the warns . */
public static void registerUrlTypes ( String ... typesToSkip ) { } } | final List < Vfs . UrlType > urlTypes = Lists . newArrayList ( ) ; // include a list of file extensions / filenames to be recognized
urlTypes . add ( new EmptyIfFileEndingsUrlType ( typesToSkip ) ) ; urlTypes . addAll ( Arrays . asList ( Vfs . DefaultUrlTypes . values ( ) ) ) ; Vfs . setDefaultURLTypes ( urlTypes ) ; |
public class MetricsImpl { /** * Retrieve metric data .
* Gets metric values for a single metric .
* @ param appId ID of the application . This is Application ID from the API Access settings blade in the Azure portal .
* @ param metricId ID of the metric . This is either a standard AI metric , or an application - specific custom metric . Possible values include : ' requests / count ' , ' requests / duration ' , ' requests / failed ' , ' users / count ' , ' users / authenticated ' , ' pageViews / count ' , ' pageViews / duration ' , ' client / processingDuration ' , ' client / receiveDuration ' , ' client / networkDuration ' , ' client / sendDuration ' , ' client / totalDuration ' , ' dependencies / count ' , ' dependencies / failed ' , ' dependencies / duration ' , ' exceptions / count ' , ' exceptions / browser ' , ' exceptions / server ' , ' sessions / count ' , ' performanceCounters / requestExecutionTime ' , ' performanceCounters / requestsPerSecond ' , ' performanceCounters / requestsInQueue ' , ' performanceCounters / memoryAvailableBytes ' , ' performanceCounters / exceptionsPerSecond ' , ' performanceCounters / processCpuPercentage ' , ' performanceCounters / processIOBytesPerSecond ' , ' performanceCounters / processPrivateBytes ' , ' performanceCounters / processorCpuPercentage ' , ' availabilityResults / availabilityPercentage ' , ' availabilityResults / duration ' , ' billing / telemetryCount ' , ' customEvents / count '
* @ param serviceCallback the async ServiceCallback to handle successful and failed responses .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceFuture } object */
public ServiceFuture < MetricsResult > getAsync ( String appId , MetricId metricId , final ServiceCallback < MetricsResult > serviceCallback ) { } } | return ServiceFuture . fromResponse ( getWithServiceResponseAsync ( appId , metricId ) , serviceCallback ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.