signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class RuntimeJavadoc { /** * Gets the Javadoc of the given enum constant .
* The return value is always non - null . If no Javadoc is available , the returned object ' s
* { @ link BaseJavadoc # isEmpty isEmpty ( ) } method will return { @ code true } .
* Implementation note : this method first retrieves the Javadoc of the class , and then matches the enum constant ' s
* name with the correct documentation . If the client code ' s purpose is to loop through all enum constants docs ,
* prefer using { @ link # getJavadoc ( Class ) } ( or one of its overloads ) , and calling
* { @ link ClassJavadoc # getEnumConstants ( ) } on the returned class doc to retrieve enum constant docs .
* @ param enumValue the enum constant whose Javadoc you want to retrieve
* @ return the given enum constant ' s Javadoc */
public static FieldJavadoc getJavadoc ( Enum < ? > enumValue ) { } } | ClassJavadoc javadoc = getJavadoc ( enumValue . getDeclaringClass ( ) ) ; return findFieldJavadoc ( javadoc . getEnumConstants ( ) , enumValue . name ( ) ) ; |
public class UCharacterName { /** * Sets up the name sets and the calculation of the maximum lengths .
* Equivalent to calcNameSetsLengths . */
private boolean initNameSetsLengths ( ) { } } | if ( m_maxNameLength_ > 0 ) { return true ; } String extra = "0123456789ABCDEF<>-" ; // set hex digits , used in various names , and < > - , used in extended
// names
for ( int i = extra . length ( ) - 1 ; i >= 0 ; i -- ) { add ( m_nameSet_ , extra . charAt ( i ) ) ; } // set sets and lengths from algorithmic names
m_maxNameLength_ = addAlgorithmName ( 0 ) ; // set sets and lengths from extended names
m_maxNameLength_ = addExtendedName ( m_maxNameLength_ ) ; // set sets and lengths from group names , set global maximum values
addGroupName ( m_maxNameLength_ ) ; return true ; |
public class PathElement { /** * Determine whether the given property matches this element .
* A property matches this element when property name and this key are equal ,
* values are equal or this element value is a wildcard .
* @ param property the property to check
* @ return { @ code true } if the property matches */
public boolean matches ( Property property ) { } } | return property . getName ( ) . equals ( key ) && ( value == WILDCARD_VALUE || property . getValue ( ) . asString ( ) . equals ( value ) ) ; |
public class DefaultLocalPersistenceService { /** * { @ inheritDoc } */
@ Override public void createSafeSpace ( SafeSpaceIdentifier safeSpaceId ) throws CachePersistenceException { } } | if ( safeSpaceId == null || ! ( safeSpaceId instanceof DefaultSafeSpaceIdentifier ) ) { // this cannot happen . . if identifier created before creating physical space . .
throw new AssertionError ( "Invalid safe space identifier. Identifier not created" ) ; } SafeSpace ss = ( ( DefaultSafeSpaceIdentifier ) safeSpaceId ) . safeSpace ; FileUtils . create ( ss . directory . getParentFile ( ) ) ; FileUtils . create ( ss . directory ) ; |
public class StatementBuilder { /** * set ( varName ) . { expression } . endSet ( )
* @ return an expression builder */
final public SetExpressionBuilder < T > set ( final String to ) { } } | final int sourceLineNumber = builder . getSourceLineNumber ( ) ; return new SetExpressionBuilder < T > ( new ExpressionHandler < T > ( ) { public T handleExpression ( Expression e ) { return statementHandler ( ) . handleStatement ( new SetStatement ( sourceLineNumber , to , e ) ) ; } } ) ; |
public class CatalogMetadataBuilder { /** * Set the options . Any options previously created are removed .
* @ param opts the opts
* @ return the catalog metadata builder */
@ TimerJ public CatalogMetadataBuilder withOptions ( Map < Selector , Selector > opts ) { } } | options = new HashMap < Selector , Selector > ( opts ) ; return this ; |
public class JimfsFileStore { /** * Looks up the file at the given path using the given link options . If the path is relative , the
* lookup is relative to the given working directory .
* @ throws NoSuchFileException if an element of the path other than the final element does not
* resolve to a directory or symbolic link ( e . g . it doesn ' t exist or is a regular file )
* @ throws IOException if a symbolic link cycle is detected or the depth of symbolic link
* recursion otherwise exceeds a threshold */
DirectoryEntry lookUp ( File workingDirectory , JimfsPath path , Set < ? super LinkOption > options ) throws IOException { } } | state . checkOpen ( ) ; return tree . lookUp ( workingDirectory , path , options ) ; |
public class MwsUtl { /** * Calculate String to Sign for SignatureVersion 2
* @ param serviceUri
* @ param parameters
* request parameters
* @ return String to Sign */
static String calculateStringToSignV2 ( URI serviceUri , Map < String , String > parameters ) { } } | StringBuilder data = new StringBuilder ( ) ; data . append ( "POST" ) ; data . append ( "\n" ) ; data . append ( serviceUri . getHost ( ) . toLowerCase ( ) ) ; if ( ! usesStandardPort ( serviceUri ) ) { data . append ( ":" ) ; data . append ( serviceUri . getPort ( ) ) ; } data . append ( "\n" ) ; String uri = serviceUri . getPath ( ) ; data . append ( MwsUtl . urlEncode ( uri , true ) ) ; data . append ( "\n" ) ; Map < String , String > sorted = new TreeMap < String , String > ( ) ; sorted . putAll ( parameters ) ; Iterator < Map . Entry < String , String > > pairs = sorted . entrySet ( ) . iterator ( ) ; while ( pairs . hasNext ( ) ) { Map . Entry < String , String > pair = pairs . next ( ) ; String key = pair . getKey ( ) ; data . append ( MwsUtl . urlEncode ( key , false ) ) ; data . append ( "=" ) ; String value = pair . getValue ( ) ; data . append ( MwsUtl . urlEncode ( value , false ) ) ; if ( pairs . hasNext ( ) ) { data . append ( "&" ) ; } } return data . toString ( ) ; |
public class ImgUtil { /** * 更改图片alpha值
* @ param oldPath 图片本地路径
* @ param newPath 更改alpha值后的图片保存路径
* @ param alpha 要设置的alpha值
* @ throws IOException IOException */
public static void changeAlpha ( String oldPath , String newPath , byte alpha ) throws IOException { } } | changeAlpha ( new FileInputStream ( oldPath ) , new FileOutputStream ( newPath ) , alpha ) ; |
public class AbstractSupplier { /** * Void for most suppliers */
@ Override public void setParentKey ( WV value , Mapper mapper , String column , K parentKey , Object Entity ) { } } | |
public class NonBlockingBufferedReader { /** * Reads characters into a portion of an array , reading from the underlying
* stream if necessary .
* @ param aBuf
* The buffer to be filled
* @ param nOfs
* The offset to start reading
* @ param nLen
* The number of bytes to read
* @ return The number of bytes read
* @ throws IOException
* in case reading fails */
private int _internalRead ( final char [ ] aBuf , final int nOfs , final int nLen ) throws IOException { } } | if ( m_nNextCharIndex >= m_nChars ) { /* * If the requested length is at least as large as the buffer , and if
* there is no mark / reset activity , and if line feeds are not being
* skipped , do not bother to copy the characters into the local buffer . In
* this way buffered streams will cascade harmlessly . */
if ( nLen >= m_aBuf . length && m_nMarkedChar <= UNMARKED && ! m_bSkipLF ) return m_aReader . read ( aBuf , nOfs , nLen ) ; _fill ( ) ; } if ( m_nNextCharIndex >= m_nChars ) return - 1 ; if ( m_bSkipLF ) { m_bSkipLF = false ; if ( m_aBuf [ m_nNextCharIndex ] == '\n' ) { m_nNextCharIndex ++ ; if ( m_nNextCharIndex >= m_nChars ) _fill ( ) ; if ( m_nNextCharIndex >= m_nChars ) return - 1 ; } } final int nBytesRead = Math . min ( nLen , m_nChars - m_nNextCharIndex ) ; System . arraycopy ( m_aBuf , m_nNextCharIndex , aBuf , nOfs , nBytesRead ) ; m_nNextCharIndex += nBytesRead ; return nBytesRead ; |
public class AbstractNamedInputHandler { /** * Creates new empty Bean instance
* @ param clazz Class description which would be instantiated
* @ return empty Bean instance */
private T createEmpty ( Class < ? > clazz ) { } } | T emptyInstance = null ; if ( clazz . isInterface ( ) ) { throw new IllegalArgumentException ( "Specified class is an interface: " + clazz . getName ( ) ) ; } try { emptyInstance = ( T ) clazz . newInstance ( ) ; } catch ( InstantiationException ex ) { throw new IllegalArgumentException ( clazz . getName ( ) + ". Is it an abstract class?" , ex ) ; } catch ( IllegalAccessException ex ) { throw new IllegalArgumentException ( clazz . getName ( ) + "Is the constructor accessible?" , ex ) ; } return emptyInstance ; |
public class AbstractRedG { /** * Searches through the list of entities to insert into the database and returns all of the specified type that match the passed { @ link Predicate } .
* @ param type The class of the entities that should be searched for
* @ param filter A predicate that gets called for every entity that has the requested type . An entity gets added to the entities returned by this method if
* the predicate returns { @ code true }
* @ param < T > The entity type
* @ return A list of all entities of the requested type that match the predicate */
public < T extends RedGEntity > List < T > findEntities ( final Class < T > type , final Predicate < T > filter ) { } } | return this . entities . stream ( ) . filter ( obj -> Objects . equals ( type , obj . getClass ( ) ) ) . map ( type :: cast ) . filter ( filter ) . collect ( Collectors . toList ( ) ) ; |
public class HsqlProperties { /** * Choice limited to values list , defaultValue must be in the values list . */
public int getIntegerProperty ( String key , int defaultValue , int [ ] values ) { } } | String prop = getProperty ( key ) ; int value = defaultValue ; try { if ( prop != null ) { value = Integer . parseInt ( prop ) ; } } catch ( NumberFormatException e ) { } if ( ArrayUtil . find ( values , value ) == - 1 ) { return defaultValue ; } return value ; |
public class OrphanedEvent { /** * Gets id of the updated message .
* @ return Id of the updated message . */
public String getMessageId ( ) { } } | return ( data != null && data . payload != null ) ? data . payload . messageId : null ; |
public class ArrayConverter { /** * 数组对数组转换
* @ param array 被转换的数组值
* @ return 转换后的数组 */
private Object convertArrayToArray ( Object array ) { } } | final Class < ? > valueComponentType = ArrayUtil . getComponentType ( array ) ; if ( valueComponentType == targetComponentType ) { return array ; } final int len = ArrayUtil . length ( array ) ; final Object result = Array . newInstance ( targetComponentType , len ) ; final ConverterRegistry converter = ConverterRegistry . getInstance ( ) ; for ( int i = 0 ; i < len ; i ++ ) { Array . set ( result , i , converter . convert ( targetComponentType , Array . get ( array , i ) ) ) ; } return result ; |
public class PeriodFormatterBuilder { /** * Append a field prefix which applies only to the next appended field . If
* the field is not printed , neither is the prefix .
* @ param prefix custom prefix
* @ return this PeriodFormatterBuilder
* @ see # appendSuffix */
private PeriodFormatterBuilder appendPrefix ( PeriodFieldAffix prefix ) { } } | if ( prefix == null ) { throw new IllegalArgumentException ( ) ; } if ( iPrefix != null ) { prefix = new CompositeAffix ( iPrefix , prefix ) ; } iPrefix = prefix ; return this ; |
public class ExecutorMetrics { /** * Calling this twice will not actually overwrite the gauge
* @ param collectionSizeGauge */
public void registerCollectionSizeGauge ( CollectionSizeGauge collectionSizeGauge ) { } } | String name = createMetricName ( LocalTaskExecutorService . class , "queue-size" ) ; metrics . register ( name , collectionSizeGauge ) ; |
public class AdvancedRecyclerArrayAdapter { /** * Called by the DiffUtil to decide whether two object represent the same Item .
* For example , if your items have unique ids , this method should check their id equality .
* @ param oldItem The position of the item in the old list
* @ param newItem The position of the item in the new list
* @ return True if the two items represent the same object or false if they are different .
* @ see # getItemId ( Object ) */
public boolean isItemTheSame ( @ Nullable final T oldItem , @ Nullable final T newItem ) { } } | if ( oldItem == null && newItem == null ) { return true ; } if ( oldItem == null || newItem == null ) { return false ; } final Object oldId = getItemId ( oldItem ) ; final Object newId = getItemId ( newItem ) ; return ( oldId == newId ) || ( oldId != null && oldId . equals ( newId ) ) ; |
public class RequestBuilder { /** * POST */
private static HttpRequestBase addParamsPost ( AsyncRequest asyncRequest ) { } } | HttpPost post = new HttpPost ( asyncRequest . getUrl ( ) ) ; Headers header = asyncRequest . getHeader ( ) ; if ( header != null ) { post . setHeaders ( header . toHeaderArray ( ) ) ; } Parameters parameter = asyncRequest . getParameter ( ) ; if ( parameter != null ) { if ( parameter . getNameValuePair ( ) != null ) { try { post . setEntity ( new UrlEncodedFormEntity ( parameter . getNameValuePair ( ) , asyncRequest . getReqCharset ( ) . charset ) ) ; } catch ( UnsupportedEncodingException e ) { e . printStackTrace ( ) ; } } else if ( parameter . getText ( ) != null ) { post . setEntity ( new StringEntity ( parameter . getText ( ) , ContentType . create ( parameter . getContentType ( ) == null ? ContentType . DEFAULT_TEXT . getMimeType ( ) : parameter . getContentType ( ) , Charset . forName ( parameter . getContentEncoding ( ) == null ? asyncRequest . getReqCharset ( ) . charset : parameter . getContentEncoding ( ) ) ) ) ) ; } else if ( parameter . getByteData ( ) != null ) { EntityBuilder entityBuilder = EntityBuilder . create ( ) ; entityBuilder . setBinary ( parameter . getByteData ( ) ) ; if ( parameter . getContentEncoding ( ) != null ) { entityBuilder . setContentEncoding ( parameter . getContentEncoding ( ) ) ; } entityBuilder . setContentType ( ContentType . create ( parameter . getContentType ( ) == null ? ContentType . DEFAULT_TEXT . getMimeType ( ) : parameter . getContentType ( ) , Charset . forName ( parameter . getContentEncoding ( ) == null ? asyncRequest . getReqCharset ( ) . charset : parameter . getContentEncoding ( ) ) ) ) ; post . setEntity ( entityBuilder . build ( ) ) ; } else if ( parameter . getFile ( ) != null ) { EntityBuilder entityBuilder = EntityBuilder . create ( ) ; entityBuilder . setFile ( parameter . getFile ( ) ) ; if ( parameter . getContentEncoding ( ) != null ) { entityBuilder . setContentEncoding ( parameter . getContentEncoding ( ) ) ; } entityBuilder . setContentType ( ContentType . create ( parameter . getContentType ( ) == null ? ContentType . DEFAULT_TEXT . getMimeType ( ) : parameter . getContentType ( ) , Charset . forName ( parameter . getContentEncoding ( ) == null ? asyncRequest . getReqCharset ( ) . charset : parameter . getContentEncoding ( ) ) ) ) ; post . setEntity ( entityBuilder . build ( ) ) ; } } return post ; |
public class JLocationScreen { /** * The init ( ) method is called by the AWT when an applet is first loaded or
* reloaded . Override this method to perform whatever initialization your
* applet needs , such as initializing data structures , loading images or
* fonts , creating frame windows , setting the layout manager , or adding UI
* components . */
public void init ( Object parent , Object strLocationParam ) { } } | super . init ( parent , null ) ; BaseApplet applet = ( BaseApplet ) parent ; JTreePanel panelLeft = new JTreePanel ( this , applet ) ; if ( strLocationParam instanceof String ) panelLeft . setLocationParamName ( ( String ) strLocationParam ) ; panelLeft . addPropertyChangeListener ( this ) ; // So I can pass it down
JPanel panelRight = new JMapPanel ( this , applet ) ; JSplitPane panel = new JSplitPane ( JSplitPane . HORIZONTAL_SPLIT , panelLeft , panelRight ) ; panel . setContinuousLayout ( true ) ; panel . setPreferredSize ( new Dimension ( 500 , 400 ) ) ; panel . setOpaque ( false ) ; this . setLayout ( new BorderLayout ( ) ) ; this . setPreferredSize ( new Dimension ( 500 , 300 ) ) ; this . add ( panel , BorderLayout . CENTER ) ; |
public class StoreFactoryImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public String convertUserTypeToString ( EDataType eDataType , Object instanceValue ) { } } | return instanceValue == null ? null : instanceValue . toString ( ) ; |
public class MathUtils { /** * Determines the maximum numerical value in an array of values .
* @ param values an array of numerical values from which to determine the maximum value .
* @ return the maximum numerical value in the array of numerical values . Returns Double . NaN
* if the array of values is null .
* @ see java . lang . Double # NaN
* @ see java . lang . Math # max ( double , double ) */
@ NullSafe public static double max ( final double ... values ) { } } | double maxValue = Double . NaN ; if ( values != null ) { for ( double value : values ) { maxValue = ( Double . isNaN ( maxValue ) ? value : Math . max ( maxValue , value ) ) ; } } return maxValue ; |
public class BatchExtractor { /** * Main entry
* @ param args
* command line parameters : the path of the PDF directory , the path of the output , the PDF parser types , the debug mode , and the test mode .
* @ throws IOException */
public static void main ( String [ ] args ) throws IOException { } } | if ( args . length == 3 ) { String pdfDirPath = args [ 0 ] ; String outputDirPath = args [ 1 ] ; String parserType = args [ 2 ] ; extractTables ( pdfDirPath , outputDirPath , parserType ) ; } else if ( args . length == 4 ) { String pdfDirPath = args [ 0 ] ; String outputDirPath = args [ 1 ] ; String parserType = args [ 2 ] ; if ( args [ 3 ] . compareTo ( "--debug" ) == 0 ) { Config . DEBUG_MODE = true ; } else if ( args [ 3 ] . compareTo ( "--small" ) == 0 ) { Config . SMALL_TEST = true ; } extractTables ( pdfDirPath , outputDirPath , parserType ) ; } else { showUsage ( ) ; } |
public class ImagePipeline { /** * Returns whether the image is stored in the disk cache .
* @ param imageRequest the imageRequest for the image to be looked up .
* @ return true if the image was found in the disk cache , false otherwise . */
public DataSource < Boolean > isInDiskCache ( final ImageRequest imageRequest ) { } } | final CacheKey cacheKey = mCacheKeyFactory . getEncodedCacheKey ( imageRequest , null ) ; final SimpleDataSource < Boolean > dataSource = SimpleDataSource . create ( ) ; mMainBufferedDiskCache . contains ( cacheKey ) . continueWithTask ( new Continuation < Boolean , Task < Boolean > > ( ) { @ Override public Task < Boolean > then ( Task < Boolean > task ) throws Exception { if ( ! task . isCancelled ( ) && ! task . isFaulted ( ) && task . getResult ( ) ) { return Task . forResult ( true ) ; } return mSmallImageBufferedDiskCache . contains ( cacheKey ) ; } } ) . continueWith ( new Continuation < Boolean , Void > ( ) { @ Override public Void then ( Task < Boolean > task ) throws Exception { dataSource . setResult ( ! task . isCancelled ( ) && ! task . isFaulted ( ) && task . getResult ( ) ) ; return null ; } } ) ; return dataSource ; |
public class Streams { /** * Attempt to close an array of < tt > OutputStream < / tt > s .
* @ param streams Array of < tt > OutputStream < / tt > s to attempt to close .
* @ return < tt > True < / tt > if all streams were closed , or < tt > false < / tt > if an
* exception was thrown . */
public static boolean close ( final OutputStream [ ] streams ) { } } | boolean success = true ; for ( OutputStream stream : streams ) { boolean rv = close ( stream ) ; if ( ! rv ) success = false ; } return success ; |
public class AbstractListPreference { /** * Sets the entries of the list , which is shown by the preference .
* @ param entries
* The entries , which should be set , as an { @ link CharSequence } array . The entries may
* not be null */
public final void setEntries ( @ NonNull final CharSequence [ ] entries ) { } } | Condition . INSTANCE . ensureNotNull ( entries , "The entries may not be null" ) ; this . entries = entries ; |
public class StatsEntity { /** * Request the Active Users Count ( logged in during the last 30 days ) . A token with scope read : stats is needed .
* See https : / / auth0 . com / docs / api / management / v2 # ! / Stats / get _ active _ users
* @ return a Request to execute . */
public Request < Integer > getActiveUsersCount ( ) { } } | String url = baseUrl . newBuilder ( ) . addPathSegments ( "api/v2/stats/active-users" ) . build ( ) . toString ( ) ; CustomRequest < Integer > request = new CustomRequest < > ( client , url , "GET" , new TypeReference < Integer > ( ) { } ) ; request . addHeader ( "Authorization" , "Bearer " + apiToken ) ; return request ; |
public class Providers { /** * Instantiates the dagger module associated with the provider reflectively . Use this when
* building { @ link DNSApiManager } via Dagger when looking up a provider by name .
* ex .
* < pre >
* provider = withUrl ( getByName ( providerName ) , overrideUrl ) ;
* module = getByName ( provider ) ;
* ultraDns = ObjectGraph . create ( provide ( provider ) , module , credentials ( username ,
* password ) ) . get ( DNSApiManager . class ) ;
* < / pre >
* @ throws IllegalArgumentException if there is no static inner class named { @ code Module } , or it
* is not possible to instantiate it . */
public static Object instantiateModule ( Provider in ) throws IllegalArgumentException { } } | String moduleClassName ; if ( in . getClass ( ) . isAnonymousClass ( ) ) { moduleClassName = in . getClass ( ) . getSuperclass ( ) . getName ( ) + "$Module" ; } else { moduleClassName = in . getClass ( ) . getName ( ) + "$Module" ; } Class < ? > moduleClass ; try { moduleClass = Class . forName ( moduleClassName ) ; } catch ( ClassNotFoundException e ) { throw new IllegalArgumentException ( in . getClass ( ) . getName ( ) + " should have a static inner class named Module" , e ) ; } catch ( Exception e ) { throw new IllegalArgumentException ( "exception attempting to instantiate " + moduleClassName + " for provider " + in . name ( ) , e ) ; } try { Constructor < ? > ctor = moduleClass . getDeclaredConstructor ( ) ; // allow private or package protected ctors
ctor . setAccessible ( true ) ; return ctor . newInstance ( ) ; } catch ( NoSuchMethodException e ) { throw new IllegalArgumentException ( "ensure " + moduleClassName + " has a no-args constructor" , e ) ; } catch ( Exception e ) { throw new IllegalArgumentException ( "exception attempting to instantiate " + moduleClassName + " for provider " + in . name ( ) , e ) ; } |
public class HostsResource { /** * Returns the current { @ link Deployment } of { @ code job } on { @ code host } if it is deployed .
* @ param host The host where the job is deployed .
* @ param jobId The ID of the job .
* @ return The response . */
@ GET @ Path ( "/{host}/jobs/{job}" ) @ Produces ( APPLICATION_JSON ) @ Timed @ ExceptionMetered public Optional < Deployment > jobGet ( @ PathParam ( "host" ) final String host , @ PathParam ( "job" ) final JobId jobId ) { } } | if ( ! jobId . isFullyQualified ( ) ) { throw badRequest ( ) ; } return Optional . fromNullable ( model . getDeployment ( host , jobId ) ) ; |
public class MatrixVectorReader { /** * Reads a line , and trims it of surrounding whitespace
* @ throws IOException
* If either I / O errors occur , or there was nothing to read */
private String readTrimmedLine ( ) throws IOException { } } | String line = readLine ( ) ; if ( line != null ) return line . trim ( ) ; else throw new EOFException ( ) ; |
public class DefaultXMLFactoriesConfig { /** * { @ inheritDoc } */
@ Override public DocumentBuilderFactory createDocumentBuilderFactory ( ) { } } | DocumentBuilderFactory instance = DocumentBuilderFactory . newInstance ( ) ; instance . setXIncludeAware ( this . isXIncludeAware ) ; instance . setExpandEntityReferences ( this . isExpandEntityReferences ) ; // for ( String featureDefault : FEATURE _ DEFAULTS ) {
// String [ ] featureValue = featureDefault . split ( " # " ) ;
// try {
// instance . setFeature ( featureValue [ 0 ] , Boolean . valueOf ( featureValue [ 1 ] ) ) ;
// } catch ( ParserConfigurationException e ) {
// / / No worries if one feature is not supported .
if ( ! NamespacePhilosophy . AGNOSTIC . equals ( namespacePhilosophy ) ) { instance . setNamespaceAware ( NamespacePhilosophy . HEDONISTIC . equals ( namespacePhilosophy ) ) ; } return instance ; |
public class SQLiteExecutor { /** * Insert one record into database .
* To exclude the some properties or default value , invoke { @ code com . landawn . abacus . util . N # entity2Map ( Object , boolean , Collection , NamingPolicy ) }
* @ param table
* @ param record can be < code > Map < / code > or < code > entity < / code > with getter / setter methods
* @ return
* @ see com . landawn . abacus . util . Maps # entity2Map ( Object , boolean , Collection , NamingPolicy ) */
public long insert ( String table , Object record ) { } } | table = formatName ( table ) ; return insert ( table , record , SQLiteDatabase . CONFLICT_NONE ) ; |
public class ResolvedTypes { /** * / * @ Nullable */
@ Override public IConstructorLinkingCandidate getLinkingCandidate ( /* @ Nullable */
XConstructorCall constructorCall ) { } } | if ( ! shared . allLinking . contains ( constructorCall ) ) { return null ; } return ( IConstructorLinkingCandidate ) doGetCandidate ( constructorCall ) ; |
public class MapWithProtoValuesSubject { /** * Excludes the top - level message fields with the given tag numbers from the comparison .
* < p > This method adds on any previous { @ link FieldScope } related settings , overriding previous
* changes to ensure the specified fields are ignored recursively . All sub - fields of these field
* numbers are ignored , and all sub - messages of type { @ code M } will also have these field numbers
* ignored .
* < p > If an invalid field number is supplied , the terminal comparison operation will throw a
* runtime exception . */
public MapWithProtoValuesFluentAssertion < M > ignoringFieldsForValues ( Iterable < Integer > fieldNumbers ) { } } | return usingConfig ( config . ignoringFields ( fieldNumbers ) ) ; |
public class Reflect { /** * Call a constructor .
* This is roughly equivalent to { @ link Constructor # newInstance ( Object . . . ) } . If the wrapped object is a
* { @ link Class } , then this will create a new object of that class . If the wrapped object is any other
* { @ link Object } , then this will create a new object of the same type .
* Just like { @ link Constructor # newInstance ( Object . . . ) } , this will try to wrap primitive types or unwrap primitive
* type wrappers if applicable . If several constructors are applicable , by that rule , the first one encountered is
* called . i . e . when calling < code > < pre >
* on ( C . class ) . create ( 1 , 1 ) ;
* < / pre > < / code > The first of the following constructors will be applied : < code > < pre >
* public C ( int param1 , Integer param2 ) ;
* public C ( Integer param1 , int param2 ) ;
* public C ( Number param1 , Number param2 ) ;
* public C ( Number param1 , Object param2 ) ;
* public C ( int param1 , Object param2 ) ;
* < / pre > < / code >
* @ param args
* The constructor arguments
* @ return The wrapped new object , to be used for further reflection .
* @ throws ReflectException
* If any reflection exception occurred . */
public Reflect create ( Object ... args ) throws ReflectException { } } | Class < ? > [ ] types = types ( args ) ; // Try invoking the " canonical " constructor , i . e . the one with exact
// matching argument types
try { Constructor < ? > constructor = type ( ) . getDeclaredConstructor ( types ) ; return on ( constructor , args ) ; } // If there is no exact match , try to find one that has a " similar "
// signature if primitive argument types are converted to their wrappers
catch ( NoSuchMethodException e ) { for ( Constructor < ? > constructor : type ( ) . getConstructors ( ) ) { if ( match ( constructor . getParameterTypes ( ) , types ) ) { return on ( constructor , args ) ; } } throw new ReflectException ( e ) ; } |
public class CmsSetupBean { /** * Returns the html code for component selection . < p >
* @ return html code */
public String htmlComponents ( ) { } } | StringBuffer html = new StringBuffer ( 1024 ) ; Iterator < CmsSetupComponent > itComponents = CmsCollectionsGenericWrapper . < CmsSetupComponent > list ( m_components . elementList ( ) ) . iterator ( ) ; while ( itComponents . hasNext ( ) ) { CmsSetupComponent component = itComponents . next ( ) ; html . append ( htmlComponent ( component ) ) ; } return html . toString ( ) ; |
public class ScreenCapture { /** * < p > Provide an easy to use index . html file for viewing the screenshots .
* < p > The base directory is expected to exist at this point .
* @ throws IOException */
private void updateIndexFile ( int stepNumber , File file , String methodName , String [ ] values ) throws IOException { } } | File indexFile = initializeIndexIfNeeded ( ) ; BufferedWriter w = new BufferedWriter ( new FileWriter ( indexFile , stepNumber > INITIAL_STEP_NUMBER ) ) ; try { String title = "| " + methodName + " | " + ( values . length > 0 ? values [ 0 ] : "" ) + " | " + ( values . length > 1 ? values [ 1 ] : "" ) + " |" ; w . write ( "<h2>" + stepNumber + ". " + title + "</h2>\n" ) ; w . write ( "<img src='" + file . getName ( ) + "' alt='" + title + "'/>\n" ) ; } finally { try { w . close ( ) ; } catch ( IOException e ) { LOG . error ( "Unable to close screenshot file " + file . getPath ( ) , e ) ; } } |
public class Optionals { /** * Sequence operation , take a Collection of Optionals and turn it into a Optional with a Collection
* By constrast with { @ link Optionals # sequencePresent ( IterableX ) } , if any Optionals are zero the result
* is an zero Optional
* < pre >
* { @ code
* Optional < Integer > just = Optional . of ( 10 ) ;
* Optional < Integer > none = Optional . zero ( ) ;
* Optional < Seq < Integer > > opts = Optionals . sequence ( Seq . of ( just , none , Optional . of ( 1 ) ) ) ;
* Optional . zero ( ) ;
* < / pre >
* @ param opts Maybes to Sequence
* @ return Maybe with a List of values */
public static < T > Optional < ReactiveSeq < T > > sequence ( final IterableX < ? extends Optional < T > > opts ) { } } | return sequence ( opts . stream ( ) ) ; |
public class FontBuilder { /** * Build a real font with name and size .
* @ param rFont the real font enum
* @ return the javafx font */
private Font buildRealFont ( final RealFont rFont ) { } } | checkFontStatus ( rFont ) ; return Font . font ( transformFontName ( rFont . name ( ) . name ( ) ) , rFont . size ( ) ) ; |
public class ValueStack { /** * popString .
* @ return a { @ link java . lang . String } object .
* @ throws java . text . ParseException if any . */
public String popString ( ) throws ParseException { } } | final Object popped = super . pop ( ) ; if ( popped instanceof String ) return ( String ) popped ; /* * This is probably an unquoted single word literal . */
if ( popped instanceof TokVariable ) return ( ( TokVariable ) popped ) . getName ( ) ; throw new ParseException ( "Literal required, found " + popped . getClass ( ) . getSimpleName ( ) , 0 ) ; |
public class BackendServiceClient { /** * Retrieves the list of BackendService resources available to the specified project .
* < p > Sample code :
* < pre > < code >
* try ( BackendServiceClient backendServiceClient = BackendServiceClient . create ( ) ) {
* ProjectName project = ProjectName . of ( " [ PROJECT ] " ) ;
* for ( BackendService element : backendServiceClient . listBackendServices ( project ) . iterateAll ( ) ) {
* / / doThingsWith ( element ) ;
* < / code > < / pre >
* @ param project Project ID for this request .
* @ throws com . google . api . gax . rpc . ApiException if the remote call fails */
@ BetaApi public final ListBackendServicesPagedResponse listBackendServices ( ProjectName project ) { } } | ListBackendServicesHttpRequest request = ListBackendServicesHttpRequest . newBuilder ( ) . setProject ( project == null ? null : project . toString ( ) ) . build ( ) ; return listBackendServices ( request ) ; |
public class EclipselinkIntrospection { /** * DatabaseField */
private void processDatabaseFieldCollection ( final Object databaseFieldCollection ) { } } | if ( databaseFieldCollection == null || ! isCastable ( "java.util.Collection" , databaseFieldCollection . getClass ( ) ) ) { return ; } final Collection < ? > c = ( Collection < ? > ) databaseFieldCollection ; for ( Object descriptor : c ) { processDatabaseFieldObject ( descriptor ) ; } |
public class ConfigDocumentFactory { /** * Parses a file into a ConfigDocument instance .
* @ param file
* the file to parse
* @ param options
* parse options to control how the file is interpreted
* @ return the parsed configuration
* @ throws com . typesafe . config . ConfigException on IO or parse errors */
public static ConfigDocument parseFile ( File file , ConfigParseOptions options ) { } } | return Parseable . newFile ( file , options ) . parseConfigDocument ( ) ; |
public class IncludedResponse { /** * PQ97429 */
public void sendRedirect303 ( String location ) { } } | // throw new IllegalStateException ( nls . getString ( " Illegal . from . included . servlet " , " Illegal from included servlet " ) ) ;
logger . logp ( Level . FINE , CLASS_NAME , "sendRedirect303" , nls . getString ( "Illegal.from.included.servlet" , "Illegal from included servlet" ) , "sendRedirect303" ) ; |
public class HttpUtil { /** * Fetch charset from Content - Type header value .
* @ param contentTypeValue Content - Type header value to parse
* @ param defaultCharset result to use in case of empty , incorrect or doesn ' t contain required part header value
* @ return the charset from message ' s Content - Type header or { @ code defaultCharset }
* if charset is not presented or unparsable */
public static Charset getCharset ( CharSequence contentTypeValue , Charset defaultCharset ) { } } | if ( contentTypeValue != null ) { CharSequence charsetCharSequence = getCharsetAsSequence ( contentTypeValue ) ; if ( charsetCharSequence != null ) { try { return Charset . forName ( charsetCharSequence . toString ( ) ) ; } catch ( UnsupportedCharsetException ignored ) { return defaultCharset ; } } else { return defaultCharset ; } } else { return defaultCharset ; } |
public class TimeParametersImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public NotificationChain basicSetValidationTime ( Parameter newValidationTime , NotificationChain msgs ) { } } | Parameter oldValidationTime = validationTime ; validationTime = newValidationTime ; if ( eNotificationRequired ( ) ) { ENotificationImpl notification = new ENotificationImpl ( this , Notification . SET , BpsimPackage . TIME_PARAMETERS__VALIDATION_TIME , oldValidationTime , newValidationTime ) ; if ( msgs == null ) msgs = notification ; else msgs . add ( notification ) ; } return msgs ; |
public class QueueName { /** * Constructs this class from byte array of queue URI .
* @ param bytes respresenting URI
* @ return An instance of { @ link QueueName } */
public static QueueName from ( byte [ ] bytes ) { } } | return new QueueName ( URI . create ( new String ( bytes , Charsets . US_ASCII ) ) ) ; |
public class CrsUtilities { /** * Fill the prj file with the actual map projection .
* @ param filePath the path to the regarding data or prj file .
* @ param extention the extention of the data file . If < code > null < / code > , the crs is written to filePath directly .
* @ param crs the { @ link CoordinateReferenceSystem } to write .
* @ throws IOException */
@ SuppressWarnings ( "nls" ) public static void writeProjectionFile ( String filePath , String extention , CoordinateReferenceSystem crs ) throws IOException { } } | /* * fill a prj file */
String prjPath = null ; if ( extention != null && filePath . toLowerCase ( ) . endsWith ( "." + extention ) ) { int dotLoc = filePath . lastIndexOf ( "." ) ; prjPath = filePath . substring ( 0 , dotLoc ) ; prjPath = prjPath + ".prj" ; } else { if ( ! filePath . endsWith ( ".prj" ) ) { prjPath = filePath + ".prj" ; } else { prjPath = filePath ; } } try ( BufferedWriter bufferedWriter = new BufferedWriter ( new FileWriter ( prjPath ) ) ) { bufferedWriter . write ( crs . toWKT ( ) ) ; } |
public class Weight { /** * Creates a new weight with value equal to the sum of both weights . Note
* that + inf and - inf cannot be added . If you try , an
* IllegalArgumentException will be thrown .
* @ param w
* a weight .
* @ return a new weight . */
public Weight add ( Weight w ) { } } | if ( w == null ) { return new Weight ( this ) ; } else { boolean wIsInfinity = w . isInfinity ; boolean wPosOrNeg = w . posOrNeg ; if ( ( isInfinity && posOrNeg && wIsInfinity && ! wPosOrNeg ) || ( isInfinity && ! posOrNeg && wIsInfinity && wPosOrNeg ) ) { throw new IllegalArgumentException ( "+inf - inf!" ) ; } else if ( ( isInfinity && posOrNeg ) || ( w . isInfinity && wPosOrNeg ) ) { return WeightFactory . POS_INFINITY ; } else if ( ( isInfinity && ! posOrNeg ) || ( wIsInfinity && ! wPosOrNeg ) ) { return WeightFactory . NEG_INFINITY ; } else { return new Weight ( val + w . val ) ; } } |
public class ContentKeyPoliciesInner { /** * List Content Key Policies .
* Lists the Content Key Policies in the account .
* @ param nextPageLink The NextLink from the previous successful call to List operation .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the PagedList & lt ; ContentKeyPolicyInner & gt ; object */
public Observable < Page < ContentKeyPolicyInner > > listNextAsync ( final String nextPageLink ) { } } | return listNextWithServiceResponseAsync ( nextPageLink ) . map ( new Func1 < ServiceResponse < Page < ContentKeyPolicyInner > > , Page < ContentKeyPolicyInner > > ( ) { @ Override public Page < ContentKeyPolicyInner > call ( ServiceResponse < Page < ContentKeyPolicyInner > > response ) { return response . body ( ) ; } } ) ; |
public class CmsXmlGroupContainer { /** * Adds the given container page to the given element . < p >
* @ param cms the current CMS object
* @ param parent the element to add it
* @ param groupContainer the container page to add
* @ throws CmsException if something goes wrong */
protected void saveGroupContainer ( CmsObject cms , Element parent , CmsGroupContainerBean groupContainer ) throws CmsException { } } | parent . clearContent ( ) ; Element groupContainerElem = parent . addElement ( XmlNode . GroupContainers . name ( ) ) ; groupContainerElem . addElement ( XmlNode . Title . name ( ) ) . addCDATA ( groupContainer . getTitle ( ) ) ; groupContainerElem . addElement ( XmlNode . Description . name ( ) ) . addCDATA ( groupContainer . getDescription ( ) ) ; for ( String type : groupContainer . getTypes ( ) ) { groupContainerElem . addElement ( XmlNode . Type . name ( ) ) . addCDATA ( type ) ; } // the elements
for ( CmsContainerElementBean element : groupContainer . getElements ( ) ) { CmsResource res = cms . readResource ( element . getId ( ) , CmsResourceFilter . IGNORE_EXPIRATION ) ; if ( OpenCms . getResourceManager ( ) . getResourceType ( res . getTypeId ( ) ) . getTypeName ( ) . equals ( CmsResourceTypeXmlContainerPage . GROUP_CONTAINER_TYPE_NAME ) ) { LOG . warn ( Messages . get ( ) . container ( Messages . LOG_WARN_ELEMENT_GROUP_INSIDE_ELEMENT_GROUP_0 ) ) ; continue ; } Element elemElement = groupContainerElem . addElement ( XmlNode . Element . name ( ) ) ; // the element
Element uriElem = elemElement . addElement ( XmlNode . Uri . name ( ) ) ; fillResource ( cms , uriElem , res ) ; // the properties
Map < String , String > properties = element . getIndividualSettings ( ) ; Map < String , CmsXmlContentProperty > propertiesConf = OpenCms . getADEManager ( ) . getElementSettings ( cms , res ) ; CmsXmlContentPropertyHelper . saveProperties ( cms , elemElement , properties , propertiesConf ) ; } |
public class DocumentSpecies { /** * setter for familyName - sets e . g . Homo _ sapiens , or None
* @ generated
* @ param v value to set into the feature */
public void setFamilyName ( String v ) { } } | if ( DocumentSpecies_Type . featOkTst && ( ( DocumentSpecies_Type ) jcasType ) . casFeat_familyName == null ) jcasType . jcas . throwFeatMissing ( "familyName" , "ch.epfl.bbp.uima.types.DocumentSpecies" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( DocumentSpecies_Type ) jcasType ) . casFeatCode_familyName , v ) ; |
public class VaultExtendedInfosInner { /** * Get the vault extended info .
* @ param resourceGroupName The name of the resource group where the recovery services vault is present .
* @ param vaultName The name of the recovery services vault .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the VaultExtendedInfoResourceInner object */
public Observable < VaultExtendedInfoResourceInner > getAsync ( String resourceGroupName , String vaultName ) { } } | return getWithServiceResponseAsync ( resourceGroupName , vaultName ) . map ( new Func1 < ServiceResponse < VaultExtendedInfoResourceInner > , VaultExtendedInfoResourceInner > ( ) { @ Override public VaultExtendedInfoResourceInner call ( ServiceResponse < VaultExtendedInfoResourceInner > response ) { return response . body ( ) ; } } ) ; |
public class TempByteHolder { /** * Returns buffered data as String using given character encoding .
* @ param character _ encoding Name of character encoding to use for
* converting bytes to String .
* @ return Buffered data as String .
* @ throws IllegalStateException when data is too large to be read this way .
* @ throws java . io . UnsupportedEncodingException when this encoding is not supported . */
public String getString ( String character_encoding ) throws java . io . UnsupportedEncodingException { } } | if ( _file_mode ) throw new IllegalStateException ( "data too large" ) ; return new String ( _memory_buffer , 0 , _write_pos , character_encoding ) ; |
public class FaunusPipeline { /** * Emit or deny the current element based upon the provided boolean - based closure .
* @ param closure return true to emit and false to remove .
* @ return the extended FaunusPipeline */
public FaunusPipeline filter ( final String closure ) { } } | this . state . assertNotLocked ( ) ; this . state . assertNoProperty ( ) ; this . compiler . addMap ( FilterMap . Map . class , NullWritable . class , FaunusVertex . class , FilterMap . createConfiguration ( this . state . getElementType ( ) , this . validateClosure ( closure ) ) ) ; makeMapReduceString ( FilterMap . class ) ; return this ; |
public class BitsUtil { /** * Convert bitset to a string consisting of " 0 " and " 1 " , in low - endian order .
* @ param v Value to process
* @ return String representation */
public static String toStringLow ( long [ ] v ) { } } | if ( v == null ) { return "null" ; } final int mag = magnitude ( v ) ; if ( mag == 0 ) { return "0" ; } char [ ] digits = new char [ mag ] ; int pos = 0 ; outer : for ( int w = 0 ; w < v . length ; w ++ ) { long f = 1L ; for ( int i = 0 ; i < Long . SIZE ; i ++ ) { digits [ pos ] = ( ( v [ w ] & f ) == 0 ) ? '0' : '1' ; f <<= 1 ; ++ pos ; if ( pos >= mag ) { break outer ; } } } for ( ; pos < mag ; ++ pos ) { digits [ pos ] = '0' ; } return new String ( digits ) ; |
public class EnvironmentReferenceService { /** * Finds a { @ link EnvironmentReferenceModel } by name and type . */
public EnvironmentReferenceModel findEnvironmentReference ( String name , EnvironmentReferenceTagType type ) { } } | Traversal < ? , ? > query = findAllQuery ( ) . getRawTraversal ( ) . has ( EnvironmentReferenceModel . NAME , name ) . has ( EnvironmentReferenceModel . TAG_TYPE , type ) ; return getUnique ( query ) ; |
public class XSLTLayout { /** * { @ inheritDoc } */
public synchronized String format ( final LoggingEvent event ) { } } | if ( ! activated ) { activateOptions ( ) ; } if ( templates != null && encoding != null ) { outputStream . reset ( ) ; try { TransformerHandler transformer = transformerFactory . newTransformerHandler ( templates ) ; transformer . setResult ( new StreamResult ( outputStream ) ) ; transformer . startDocument ( ) ; // event element
AttributesImpl attrs = new AttributesImpl ( ) ; attrs . addAttribute ( null , "logger" , "logger" , "CDATA" , event . getLoggerName ( ) ) ; attrs . addAttribute ( null , "timestamp" , "timestamp" , "CDATA" , Long . toString ( event . timeStamp ) ) ; attrs . addAttribute ( null , "level" , "level" , "CDATA" , event . getLevel ( ) . toString ( ) ) ; attrs . addAttribute ( null , "thread" , "thread" , "CDATA" , event . getThreadName ( ) ) ; StringBuffer buf = new StringBuffer ( ) ; utcDateFormat . format ( event . timeStamp , buf ) ; attrs . addAttribute ( null , "time" , "time" , "CDATA" , buf . toString ( ) ) ; transformer . startElement ( LOG4J_NS , "event" , "event" , attrs ) ; attrs . clear ( ) ; // message element
transformer . startElement ( LOG4J_NS , "message" , "message" , attrs ) ; String msg = event . getRenderedMessage ( ) ; if ( msg != null && msg . length ( ) > 0 ) { transformer . characters ( msg . toCharArray ( ) , 0 , msg . length ( ) ) ; } transformer . endElement ( LOG4J_NS , "message" , "message" ) ; // NDC element
String ndc = event . getNDC ( ) ; if ( ndc != null ) { transformer . startElement ( LOG4J_NS , "NDC" , "NDC" , attrs ) ; char [ ] ndcChars = ndc . toCharArray ( ) ; transformer . characters ( ndcChars , 0 , ndcChars . length ) ; transformer . endElement ( LOG4J_NS , "NDC" , "NDC" ) ; } // throwable element unless suppressed
if ( ! ignoresThrowable ) { String [ ] s = event . getThrowableStrRep ( ) ; if ( s != null ) { transformer . startElement ( LOG4J_NS , "throwable" , "throwable" , attrs ) ; char [ ] nl = new char [ ] { '\n' } ; for ( int i = 0 ; i < s . length ; i ++ ) { char [ ] line = s [ i ] . toCharArray ( ) ; transformer . characters ( line , 0 , line . length ) ; transformer . characters ( nl , 0 , nl . length ) ; } transformer . endElement ( LOG4J_NS , "throwable" , "throwable" ) ; } } // location info unless suppressed
if ( locationInfo ) { LocationInfo locationInfo = event . getLocationInformation ( ) ; attrs . addAttribute ( null , "class" , "class" , "CDATA" , locationInfo . getClassName ( ) ) ; attrs . addAttribute ( null , "method" , "method" , "CDATA" , locationInfo . getMethodName ( ) ) ; attrs . addAttribute ( null , "file" , "file" , "CDATA" , locationInfo . getFileName ( ) ) ; attrs . addAttribute ( null , "line" , "line" , "CDATA" , locationInfo . getLineNumber ( ) ) ; transformer . startElement ( LOG4J_NS , "locationInfo" , "locationInfo" , attrs ) ; transformer . endElement ( LOG4J_NS , "locationInfo" , "locationInfo" ) ; } if ( properties ) { // write MDC contents out as properties element
Set mdcKeySet = MDCKeySetExtractor . INSTANCE . getPropertyKeySet ( event ) ; if ( ( mdcKeySet != null ) && ( mdcKeySet . size ( ) > 0 ) ) { attrs . clear ( ) ; transformer . startElement ( LOG4J_NS , "properties" , "properties" , attrs ) ; Object [ ] keys = mdcKeySet . toArray ( ) ; Arrays . sort ( keys ) ; for ( int i = 0 ; i < keys . length ; i ++ ) { String key = keys [ i ] . toString ( ) ; Object val = event . getMDC ( key ) ; attrs . clear ( ) ; attrs . addAttribute ( null , "name" , "name" , "CDATA" , key ) ; attrs . addAttribute ( null , "value" , "value" , "CDATA" , val . toString ( ) ) ; transformer . startElement ( LOG4J_NS , "data" , "data" , attrs ) ; transformer . endElement ( LOG4J_NS , "data" , "data" ) ; } } } transformer . endElement ( LOG4J_NS , "event" , "event" ) ; transformer . endDocument ( ) ; String body = encoding . decode ( ByteBuffer . wrap ( outputStream . toByteArray ( ) ) ) . toString ( ) ; outputStream . reset ( ) ; // must remove XML declaration since it may
// result in erroneous encoding info
// if written by FileAppender in a different encoding
if ( body . startsWith ( "<?xml " ) ) { int endDecl = body . indexOf ( "?>" ) ; if ( endDecl != - 1 ) { for ( endDecl += 2 ; endDecl < body . length ( ) && ( body . charAt ( endDecl ) == '\n' || body . charAt ( endDecl ) == '\r' ) ; endDecl ++ ) ; return body . substring ( endDecl ) ; } } return body ; } catch ( Exception ex ) { LogLog . error ( "Error during transformation" , ex ) ; return ex . toString ( ) ; } } return "No valid transform or encoding specified." ; |
public class Keys { /** * Creates { @ code Key } with the specified parent , kind name and key .
* @ param parent The { @ code Key } of the parent .
* @ param kind The kind name of the entity .
* @ param key The key of the entity .
* @ return { @ code Key } created with the specified parent , kind name and key . */
public static Key create ( Key parent , String kind , Object key ) { } } | if ( key instanceof String ) { return ( parent == null ) ? KeyFactory . createKey ( kind , ( String ) key ) : KeyFactory . createKey ( parent , kind , ( String ) key ) ; } else if ( key instanceof Long ) { return ( parent == null ) ? KeyFactory . createKey ( kind , ( Long ) key ) : KeyFactory . createKey ( parent , kind , ( Long ) key ) ; } else if ( key instanceof Key ) { return ( Key ) key ; } else { throw new IllegalArgumentException ( "'key' must be an instance of [" + String . class . getName ( ) + "] or [" + Long . class . getName ( ) + "] or [" + Key . class . getName ( ) + "]" ) ; } |
public class JpaRepositoryConfig { /** * Shortcut for builder ( entityClass ) . build ( ) .
* @ param entityClass to directly expose
* @ return config */
public static < E > JpaRepositoryConfig < E > create ( Class < E > entityClass ) { } } | return builder ( entityClass ) . build ( ) ; |
public class HTODInvalidationBuffer { /** * Call this method to clear the invalidation buffers .
* @ param forEventAlreadyFired
* - true to clear invalidation buffer which is used for event already fired .
* @ param forEventNotFired
* - true to clear invalidation buffer which is used for event not fired . */
protected synchronized void clear ( int bufferType ) { } } | final String methodName = "clear()" ; if ( bufferType == HTODInvalidationBuffer . EXPLICIT_BUFFER ) { this . explicitBuffer . clear ( ) ; } else if ( bufferType == HTODInvalidationBuffer . SCAN_BUFFER ) { this . scanBuffer . clear ( ) ; } else if ( bufferType == HTODInvalidationBuffer . GC_BUFFER ) { // todo : return GC to pool ?
for ( int i = 0 ; i < garbageCollectorBuffer . size ( ) ; i ++ ) { EvictionTableEntry evt = ( EvictionTableEntry ) garbageCollectorBuffer . get ( i ) ; cod . htod . evictionEntryPool . add ( evt ) ; } this . garbageCollectorBuffer . clear ( ) ; } traceDebug ( methodName , "cacheName=" + this . cod . cacheName + " bufferType=" + bufferType ) ; |
public class BaseRecordOwner { /** * Add this database to my database list . < br / >
* Do not call these directly , used in database init .
* @ param database The database to add . */
public void addDatabase ( Database database ) { } } | if ( m_databaseCollection == null ) m_databaseCollection = new DatabaseCollection ( this ) ; m_databaseCollection . addDatabase ( database ) ; |
public class NumericHistogram { /** * Dump the entries in the queue back into the bucket arrays
* The values are guaranteed to be sorted in increasing order after this method completes */
private void store ( PriorityQueue < Entry > queue ) { } } | nextIndex = 0 ; for ( Entry entry : queue ) { if ( entry . isValid ( ) ) { values [ nextIndex ] = entry . getValue ( ) ; weights [ nextIndex ] = entry . getWeight ( ) ; nextIndex ++ ; } } sort ( values , weights , nextIndex ) ; |
public class StartApplicationRequest { /** * Identifies the specific input , by ID , that the application starts consuming . Amazon Kinesis Analytics starts
* reading the streaming source associated with the input . You can also specify where in the streaming source you
* want Amazon Kinesis Analytics to start reading .
* @ param inputConfigurations
* Identifies the specific input , by ID , that the application starts consuming . Amazon Kinesis Analytics
* starts reading the streaming source associated with the input . You can also specify where in the streaming
* source you want Amazon Kinesis Analytics to start reading . */
public void setInputConfigurations ( java . util . Collection < InputConfiguration > inputConfigurations ) { } } | if ( inputConfigurations == null ) { this . inputConfigurations = null ; return ; } this . inputConfigurations = new java . util . ArrayList < InputConfiguration > ( inputConfigurations ) ; |
public class Matrix4f { /** * Set < code > this < / code > matrix to < code > ( T * R * S ) < sup > - 1 < / sup > < / code > , where < code > T < / code > is a translation by the given < code > ( tx , ty , tz ) < / code > ,
* < code > R < / code > is a rotation transformation specified by the quaternion < code > ( qx , qy , qz , qw ) < / code > , and < code > S < / code > is a scaling transformation
* which scales the three axes x , y and z by < code > ( sx , sy , sz ) < / code > .
* This method is equivalent to calling : < code > translationRotateScale ( . . . ) . invert ( ) < / code >
* @ see # translationRotateScale ( float , float , float , float , float , float , float , float , float , float )
* @ see # invert ( )
* @ param tx
* the number of units by which to translate the x - component
* @ param ty
* the number of units by which to translate the y - component
* @ param tz
* the number of units by which to translate the z - component
* @ param qx
* the x - coordinate of the vector part of the quaternion
* @ param qy
* the y - coordinate of the vector part of the quaternion
* @ param qz
* the z - coordinate of the vector part of the quaternion
* @ param qw
* the scalar part of the quaternion
* @ param sx
* the scaling factor for the x - axis
* @ param sy
* the scaling factor for the y - axis
* @ param sz
* the scaling factor for the z - axis
* @ return this */
public Matrix4f translationRotateScaleInvert ( float tx , float ty , float tz , float qx , float qy , float qz , float qw , float sx , float sy , float sz ) { } } | boolean one = Math . abs ( sx ) == 1.0f && Math . abs ( sy ) == 1.0f && Math . abs ( sz ) == 1.0f ; if ( one ) return translationRotateScale ( tx , ty , tz , qx , qy , qz , qw , sx , sy , sz ) . invertOrthonormal ( this ) ; float nqx = - qx , nqy = - qy , nqz = - qz ; float dqx = nqx + nqx ; float dqy = nqy + nqy ; float dqz = nqz + nqz ; float q00 = dqx * nqx ; float q11 = dqy * nqy ; float q22 = dqz * nqz ; float q01 = dqx * nqy ; float q02 = dqx * nqz ; float q03 = dqx * qw ; float q12 = dqy * nqz ; float q13 = dqy * qw ; float q23 = dqz * qw ; float isx = 1 / sx , isy = 1 / sy , isz = 1 / sz ; this . _m00 ( isx * ( 1.0f - q11 - q22 ) ) ; this . _m01 ( isy * ( q01 + q23 ) ) ; this . _m02 ( isz * ( q02 - q13 ) ) ; this . _m03 ( 0.0f ) ; this . _m10 ( isx * ( q01 - q23 ) ) ; this . _m11 ( isy * ( 1.0f - q22 - q00 ) ) ; this . _m12 ( isz * ( q12 + q03 ) ) ; this . _m13 ( 0.0f ) ; this . _m20 ( isx * ( q02 + q13 ) ) ; this . _m21 ( isy * ( q12 - q03 ) ) ; this . _m22 ( isz * ( 1.0f - q11 - q00 ) ) ; this . _m23 ( 0.0f ) ; this . _m30 ( - m00 * tx - m10 * ty - m20 * tz ) ; this . _m31 ( - m01 * tx - m11 * ty - m21 * tz ) ; this . _m32 ( - m02 * tx - m12 * ty - m22 * tz ) ; this . _m33 ( 1.0f ) ; _properties ( PROPERTY_AFFINE ) ; return this ; |
public class Parsing { /** * Converts the given token stream into a rendered output evaluating each expression
* against the provided context object which may be a regular Java POJO with getters
* and setters or a map of string / value pairs . */
public static String render ( List < Token > tokens , Map < String , Object > arguments ) { } } | StringBuilder builder = new StringBuilder ( ) ; for ( Token token : tokens ) { builder . append ( token . render ( arguments ) ) ; } return builder . toString ( ) ; |
public class MessageControllerManager { /** * Get jstopic message controller from JsTopicControl
* @ param topic
* @ return */
JsTopicMessageController getJsTopicMessageControllerFromJsTopicControl ( String topic ) { } } | logger . debug ( "Looking for messageController for topic '{}' from JsTopicControl annotation" , topic ) ; Instance < JsTopicMessageController < ? > > select = topicMessageController . select ( new JsTopicCtrlAnnotationLiteral ( topic ) ) ; if ( ! select . isUnsatisfied ( ) ) { logger . debug ( "Found messageController for topic '{}' from JsTopicControl annotation" , topic ) ; return select . get ( ) ; } return null ; |
public class ByteBufUtil { /** * Compares the two specified buffers as described in { @ link ByteBuf # compareTo ( ByteBuf ) } .
* This method is useful when implementing a new buffer type . */
public static int compare ( ByteBuf bufferA , ByteBuf bufferB ) { } } | final int aLen = bufferA . readableBytes ( ) ; final int bLen = bufferB . readableBytes ( ) ; final int minLength = Math . min ( aLen , bLen ) ; final int uintCount = minLength >>> 2 ; final int byteCount = minLength & 3 ; int aIndex = bufferA . readerIndex ( ) ; int bIndex = bufferB . readerIndex ( ) ; if ( uintCount > 0 ) { boolean bufferAIsBigEndian = bufferA . order ( ) == ByteOrder . BIG_ENDIAN ; final long res ; int uintCountIncrement = uintCount << 2 ; if ( bufferA . order ( ) == bufferB . order ( ) ) { res = bufferAIsBigEndian ? compareUintBigEndian ( bufferA , bufferB , aIndex , bIndex , uintCountIncrement ) : compareUintLittleEndian ( bufferA , bufferB , aIndex , bIndex , uintCountIncrement ) ; } else { res = bufferAIsBigEndian ? compareUintBigEndianA ( bufferA , bufferB , aIndex , bIndex , uintCountIncrement ) : compareUintBigEndianB ( bufferA , bufferB , aIndex , bIndex , uintCountIncrement ) ; } if ( res != 0 ) { // Ensure we not overflow when cast
return ( int ) Math . min ( Integer . MAX_VALUE , Math . max ( Integer . MIN_VALUE , res ) ) ; } aIndex += uintCountIncrement ; bIndex += uintCountIncrement ; } for ( int aEnd = aIndex + byteCount ; aIndex < aEnd ; ++ aIndex , ++ bIndex ) { int comp = bufferA . getUnsignedByte ( aIndex ) - bufferB . getUnsignedByte ( bIndex ) ; if ( comp != 0 ) { return comp ; } } return aLen - bLen ; |
public class IntStream { /** * Returns the single element of stream .
* If stream is empty , throws { @ code NoSuchElementException } .
* If stream contains more than one element , throws { @ code IllegalStateException } .
* < p > This is a short - circuiting terminal operation .
* < p > Example :
* < pre >
* stream : [ ]
* result : NoSuchElementException
* stream : [ 1]
* result : 1
* stream : [ 1 , 2 , 3]
* result : IllegalStateException
* < / pre >
* @ return single element of stream
* @ throws NoSuchElementException if stream is empty
* @ throws IllegalStateException if stream contains more than one element
* @ since 1.1.3 */
public int single ( ) { } } | if ( iterator . hasNext ( ) ) { int singleCandidate = iterator . nextInt ( ) ; if ( iterator . hasNext ( ) ) { throw new IllegalStateException ( "IntStream contains more than one element" ) ; } else { return singleCandidate ; } } else { throw new NoSuchElementException ( "IntStream contains no element" ) ; } |
public class HtmlPolicyBuilder { /** * Like { @ link # build } but can be reused to create many different policies
* each backed by a different output channel . */
public PolicyFactory toFactory ( ) { } } | ImmutableSet . Builder < String > textContainerSet = ImmutableSet . builder ( ) ; for ( Map . Entry < String , Boolean > textContainer : this . textContainers . entrySet ( ) ) { if ( Boolean . TRUE . equals ( textContainer . getValue ( ) ) ) { textContainerSet . add ( textContainer . getKey ( ) ) ; } } CompiledState compiled = compilePolicies ( ) ; return new PolicyFactory ( compiled . compiledPolicies , textContainerSet . build ( ) , ImmutableMap . copyOf ( compiled . globalAttrPolicies ) , preprocessor , postprocessor ) ; |
public class OtpMbox { /** * Send a message to a named mailbox created from the same node as this
* mailbox .
* @ param aname
* the registered name of recipient mailbox .
* @ param msg
* the body of the message to send . */
public void send ( final String aname , final OtpErlangObject msg ) { } } | home . deliver ( new OtpMsg ( self , aname , ( OtpErlangObject ) msg . clone ( ) ) ) ; |
public class GoogleDriveFileSystem { /** * Build query for Google drive .
* @ see https : / / developers . google . com / drive / v3 / web / search - parameters
* @ param folderId
* @ param fileName
* @ return Query */
@ VisibleForTesting Optional < String > buildQuery ( String folderId , String fileName ) { } } | if ( StringUtils . isEmpty ( folderId ) && StringUtils . isEmpty ( fileName ) ) { return Optional . absent ( ) ; } StringBuilder query = new StringBuilder ( ) ; if ( StringUtils . isNotEmpty ( folderId ) ) { query . append ( "'" ) . append ( folderId ) . append ( "'" ) . append ( " in parents" ) ; } if ( StringUtils . isNotEmpty ( fileName ) ) { if ( query . length ( ) > 0 ) { query . append ( " and " ) ; } query . append ( "name contains " ) . append ( "'" ) . append ( fileName ) . append ( "'" ) ; } return Optional . of ( query . toString ( ) ) ; |
public class WardenNotifier { /** * From warden alert name , de - constructs the user for whom this warden alert is associated with .
* @ param wardenAlertName Name of warden alert
* @ return User associated with the warden alert */
protected PrincipalUser getWardenUser ( String wardenAlertName ) { } } | assert ( wardenAlertName != null ) : "Warden alert name cannot be null." ; int beginIndex = wardenAlertName . indexOf ( "-" ) + 1 ; int endIndex = wardenAlertName . lastIndexOf ( "-" ) ; return PrincipalUser . findByUserName ( emf . get ( ) , wardenAlertName . substring ( beginIndex , endIndex ) ) ; |
public class JdbcDatabase { /** * Open the physical database .
* @ exception DBException On open errors . */
public void setupJDBCConnection ( String strJdbcDriver ) throws DBException { } } | if ( m_JDBCConnection != null ) return ; if ( firstTime == null ) firstTime = new Date ( ) ; if ( m_classDB == null ) { synchronized ( firstTime ) { if ( m_classDB == null ) m_classDB = ClassServiceUtility . getClassService ( ) . makeObjectFromClassName ( strJdbcDriver ) ; } } Utility . getLogger ( ) . info ( "Driver found: " + ( m_classDB != null ) ) ; m_JDBCConnection = this . getJDBCConnection ( ) ; // Setup the initial connection |
public class Log { /** * Logs debug message . < br >
* No - op if the debugging mode ( { @ link # debug } ) is disabled .
* @ param msg Message
* @ author vvakame */
public static void d ( String msg ) { } } | if ( ! debug ) { return ; } if ( messager == null ) { return ; } messager . printMessage ( Diagnostic . Kind . NOTE , msg ) ; |
public class Precedence { /** * Instantiate discrete constraints to force a set of VMs to migrate after an other set of VMs .
* @ param vmsBefore the VMs to migrate before the others { @ see vmsAfter }
* @ param vmsAfter the VMs to migrate after the others { @ see vmsBefore }
* @ return the associated list of constraints */
public static List < Precedence > newPrecedence ( Collection < VM > vmsBefore , Collection < VM > vmsAfter ) { } } | List < Precedence > l = new ArrayList < > ( vmsBefore . size ( ) * vmsAfter . size ( ) ) ; for ( VM vmb : vmsBefore ) { for ( VM vma : vmsAfter ) { l . add ( new Precedence ( vmb , vma ) ) ; } } return l ; |
public class SgClass { /** * Find an inner class by it ' s name .
* @ param name
* Full qualified name of the class to find - Cannot be null .
* @ return Class or null if it ' s not found . */
public final SgClass findClassByName ( final String name ) { } } | if ( name == null ) { throw new IllegalArgumentException ( "The argument 'name' cannot be null!" ) ; } for ( int i = 0 ; i < classes . size ( ) ; i ++ ) { final SgClass clasz = classes . get ( i ) ; if ( clasz . getName ( ) . equals ( name ) ) { return clasz ; } } return null ; |
public class BlockTree { /** * void write ( MaukaDatabase db , WriteStream os , int index )
* throws IOException
* byte [ ] buffer = getBuffer ( ) ;
* int keyLength = db . getKeyLength ( ) ;
* int len = 2 * keyLength + 5;
* for ( int ptr = index ; ptr < BLOCK _ SIZE ; ptr + = len ) {
* int code = buffer [ ptr ] & 0xff ;
* if ( code ! = INSERT ) {
* continue ;
* int pid = BitsUtil . readInt ( buffer , ptr + len - 4 ) ;
* if ( pid = = 0 ) {
* throw new IllegalStateException ( ) ;
* os . write ( buffer , ptr + 1 , len - 1 ) ; */
void fillEntries ( TableKelp table , TreeSet < TreeEntry > set , int index ) { } } | byte [ ] buffer = getBuffer ( ) ; int keyLength = table . getKeyLength ( ) ; int len = table . row ( ) . getTreeItemLength ( ) ; for ( int ptr = index ; ptr < BLOCK_SIZE ; ptr += len ) { int code = buffer [ ptr ] & 0xff ; int min = ptr + 1 ; int max = min + keyLength ; int valueOffset = max + keyLength ; byte [ ] minKey = new byte [ keyLength ] ; byte [ ] maxKey = new byte [ keyLength ] ; System . arraycopy ( buffer , min , minKey , 0 , keyLength ) ; System . arraycopy ( buffer , max , maxKey , 0 , keyLength ) ; int pid = BitsUtil . readInt ( buffer , valueOffset ) ; TreeEntry entry = new TreeEntry ( minKey , maxKey , code , pid ) ; set . add ( entry ) ; } |
public class InternalXbaseParser { /** * InternalXbase . g : 952:1 : ruleOpOther returns [ AntlrDatatypeRuleToken current = new AntlrDatatypeRuleToken ( ) ] : ( kw = ' - > ' | kw = ' . . < ' | ( kw = ' > ' kw = ' . . ' ) | kw = ' . . ' | kw = ' = > ' | ( kw = ' > ' ( ( ( ( ' > ' ' > ' ) ) = > ( kw = ' > ' kw = ' > ' ) ) | kw = ' > ' ) ) | ( kw = ' < ' ( ( ( ( ' < ' ' < ' ) ) = > ( kw = ' < ' kw = ' < ' ) ) | kw = ' < ' | kw = ' = > ' ) ) | kw = ' < > ' | kw = ' ? : ' ) ; */
public final AntlrDatatypeRuleToken ruleOpOther ( ) throws RecognitionException { } } | AntlrDatatypeRuleToken current = new AntlrDatatypeRuleToken ( ) ; Token kw = null ; enterRule ( ) ; try { // InternalXbase . g : 958:2 : ( ( kw = ' - > ' | kw = ' . . < ' | ( kw = ' > ' kw = ' . . ' ) | kw = ' . . ' | kw = ' = > ' | ( kw = ' > ' ( ( ( ( ' > ' ' > ' ) ) = > ( kw = ' > ' kw = ' > ' ) ) | kw = ' > ' ) ) | ( kw = ' < ' ( ( ( ( ' < ' ' < ' ) ) = > ( kw = ' < ' kw = ' < ' ) ) | kw = ' < ' | kw = ' = > ' ) ) | kw = ' < > ' | kw = ' ? : ' ) )
// InternalXbase . g : 959:2 : ( kw = ' - > ' | kw = ' . . < ' | ( kw = ' > ' kw = ' . . ' ) | kw = ' . . ' | kw = ' = > ' | ( kw = ' > ' ( ( ( ( ' > ' ' > ' ) ) = > ( kw = ' > ' kw = ' > ' ) ) | kw = ' > ' ) ) | ( kw = ' < ' ( ( ( ( ' < ' ' < ' ) ) = > ( kw = ' < ' kw = ' < ' ) ) | kw = ' < ' | kw = ' = > ' ) ) | kw = ' < > ' | kw = ' ? : ' )
{ // InternalXbase . g : 959:2 : ( kw = ' - > ' | kw = ' . . < ' | ( kw = ' > ' kw = ' . . ' ) | kw = ' . . ' | kw = ' = > ' | ( kw = ' > ' ( ( ( ( ' > ' ' > ' ) ) = > ( kw = ' > ' kw = ' > ' ) ) | kw = ' > ' ) ) | ( kw = ' < ' ( ( ( ( ' < ' ' < ' ) ) = > ( kw = ' < ' kw = ' < ' ) ) | kw = ' < ' | kw = ' = > ' ) ) | kw = ' < > ' | kw = ' ? : ' )
int alt14 = 9 ; alt14 = dfa14 . predict ( input ) ; switch ( alt14 ) { case 1 : // InternalXbase . g : 960:3 : kw = ' - > '
{ kw = ( Token ) match ( input , 29 , FOLLOW_2 ) ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { current . merge ( kw ) ; newLeafNode ( kw , grammarAccess . getOpOtherAccess ( ) . getHyphenMinusGreaterThanSignKeyword_0 ( ) ) ; } } break ; case 2 : // InternalXbase . g : 966:3 : kw = ' . . < '
{ kw = ( Token ) match ( input , 30 , FOLLOW_2 ) ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { current . merge ( kw ) ; newLeafNode ( kw , grammarAccess . getOpOtherAccess ( ) . getFullStopFullStopLessThanSignKeyword_1 ( ) ) ; } } break ; case 3 : // InternalXbase . g : 972:3 : ( kw = ' > ' kw = ' . . ' )
{ // InternalXbase . g : 972:3 : ( kw = ' > ' kw = ' . . ' )
// InternalXbase . g : 973:4 : kw = ' > ' kw = ' . . '
{ kw = ( Token ) match ( input , 20 , FOLLOW_15 ) ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { current . merge ( kw ) ; newLeafNode ( kw , grammarAccess . getOpOtherAccess ( ) . getGreaterThanSignKeyword_2_0 ( ) ) ; } kw = ( Token ) match ( input , 31 , FOLLOW_2 ) ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { current . merge ( kw ) ; newLeafNode ( kw , grammarAccess . getOpOtherAccess ( ) . getFullStopFullStopKeyword_2_1 ( ) ) ; } } } break ; case 4 : // InternalXbase . g : 985:3 : kw = ' . . '
{ kw = ( Token ) match ( input , 31 , FOLLOW_2 ) ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { current . merge ( kw ) ; newLeafNode ( kw , grammarAccess . getOpOtherAccess ( ) . getFullStopFullStopKeyword_3 ( ) ) ; } } break ; case 5 : // InternalXbase . g : 991:3 : kw = ' = > '
{ kw = ( Token ) match ( input , 32 , FOLLOW_2 ) ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { current . merge ( kw ) ; newLeafNode ( kw , grammarAccess . getOpOtherAccess ( ) . getEqualsSignGreaterThanSignKeyword_4 ( ) ) ; } } break ; case 6 : // InternalXbase . g : 997:3 : ( kw = ' > ' ( ( ( ( ' > ' ' > ' ) ) = > ( kw = ' > ' kw = ' > ' ) ) | kw = ' > ' ) )
{ // InternalXbase . g : 997:3 : ( kw = ' > ' ( ( ( ( ' > ' ' > ' ) ) = > ( kw = ' > ' kw = ' > ' ) ) | kw = ' > ' ) )
// InternalXbase . g : 998:4 : kw = ' > ' ( ( ( ( ' > ' ' > ' ) ) = > ( kw = ' > ' kw = ' > ' ) ) | kw = ' > ' )
{ kw = ( Token ) match ( input , 20 , FOLLOW_16 ) ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { current . merge ( kw ) ; newLeafNode ( kw , grammarAccess . getOpOtherAccess ( ) . getGreaterThanSignKeyword_5_0 ( ) ) ; } // InternalXbase . g : 1003:4 : ( ( ( ( ' > ' ' > ' ) ) = > ( kw = ' > ' kw = ' > ' ) ) | kw = ' > ' )
int alt12 = 2 ; int LA12_0 = input . LA ( 1 ) ; if ( ( LA12_0 == 20 ) ) { int LA12_1 = input . LA ( 2 ) ; if ( ( LA12_1 == EOF || ( LA12_1 >= RULE_STRING && LA12_1 <= RULE_ID ) || LA12_1 == 19 || ( LA12_1 >= 35 && LA12_1 <= 36 ) || LA12_1 == 41 || LA12_1 == 49 || ( LA12_1 >= 51 && LA12_1 <= 52 ) || LA12_1 == 54 || LA12_1 == 58 || LA12_1 == 60 || ( LA12_1 >= 64 && LA12_1 <= 66 ) || ( LA12_1 >= 69 && LA12_1 <= 81 ) || LA12_1 == 83 ) ) { alt12 = 2 ; } else if ( ( LA12_1 == 20 ) && ( synpred8_InternalXbase ( ) ) ) { alt12 = 1 ; } else { if ( state . backtracking > 0 ) { state . failed = true ; return current ; } NoViableAltException nvae = new NoViableAltException ( "" , 12 , 1 , input ) ; throw nvae ; } } else { if ( state . backtracking > 0 ) { state . failed = true ; return current ; } NoViableAltException nvae = new NoViableAltException ( "" , 12 , 0 , input ) ; throw nvae ; } switch ( alt12 ) { case 1 : // InternalXbase . g : 1004:5 : ( ( ( ' > ' ' > ' ) ) = > ( kw = ' > ' kw = ' > ' ) )
{ // InternalXbase . g : 1004:5 : ( ( ( ' > ' ' > ' ) ) = > ( kw = ' > ' kw = ' > ' ) )
// InternalXbase . g : 1005:6 : ( ( ' > ' ' > ' ) ) = > ( kw = ' > ' kw = ' > ' )
{ // InternalXbase . g : 1010:6 : ( kw = ' > ' kw = ' > ' )
// InternalXbase . g : 1011:7 : kw = ' > ' kw = ' > '
{ kw = ( Token ) match ( input , 20 , FOLLOW_16 ) ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { current . merge ( kw ) ; newLeafNode ( kw , grammarAccess . getOpOtherAccess ( ) . getGreaterThanSignKeyword_5_1_0_0_0 ( ) ) ; } kw = ( Token ) match ( input , 20 , FOLLOW_2 ) ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { current . merge ( kw ) ; newLeafNode ( kw , grammarAccess . getOpOtherAccess ( ) . getGreaterThanSignKeyword_5_1_0_0_1 ( ) ) ; } } } } break ; case 2 : // InternalXbase . g : 1024:5 : kw = ' > '
{ kw = ( Token ) match ( input , 20 , FOLLOW_2 ) ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { current . merge ( kw ) ; newLeafNode ( kw , grammarAccess . getOpOtherAccess ( ) . getGreaterThanSignKeyword_5_1_1 ( ) ) ; } } break ; } } } break ; case 7 : // InternalXbase . g : 1032:3 : ( kw = ' < ' ( ( ( ( ' < ' ' < ' ) ) = > ( kw = ' < ' kw = ' < ' ) ) | kw = ' < ' | kw = ' = > ' ) )
{ // InternalXbase . g : 1032:3 : ( kw = ' < ' ( ( ( ( ' < ' ' < ' ) ) = > ( kw = ' < ' kw = ' < ' ) ) | kw = ' < ' | kw = ' = > ' ) )
// InternalXbase . g : 1033:4 : kw = ' < ' ( ( ( ( ' < ' ' < ' ) ) = > ( kw = ' < ' kw = ' < ' ) ) | kw = ' < ' | kw = ' = > ' )
{ kw = ( Token ) match ( input , 19 , FOLLOW_17 ) ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { current . merge ( kw ) ; newLeafNode ( kw , grammarAccess . getOpOtherAccess ( ) . getLessThanSignKeyword_6_0 ( ) ) ; } // InternalXbase . g : 1038:4 : ( ( ( ( ' < ' ' < ' ) ) = > ( kw = ' < ' kw = ' < ' ) ) | kw = ' < ' | kw = ' = > ' )
int alt13 = 3 ; int LA13_0 = input . LA ( 1 ) ; if ( ( LA13_0 == 19 ) ) { int LA13_1 = input . LA ( 2 ) ; if ( ( synpred9_InternalXbase ( ) ) ) { alt13 = 1 ; } else if ( ( true ) ) { alt13 = 2 ; } else { if ( state . backtracking > 0 ) { state . failed = true ; return current ; } NoViableAltException nvae = new NoViableAltException ( "" , 13 , 1 , input ) ; throw nvae ; } } else if ( ( LA13_0 == 32 ) ) { alt13 = 3 ; } else { if ( state . backtracking > 0 ) { state . failed = true ; return current ; } NoViableAltException nvae = new NoViableAltException ( "" , 13 , 0 , input ) ; throw nvae ; } switch ( alt13 ) { case 1 : // InternalXbase . g : 1039:5 : ( ( ( ' < ' ' < ' ) ) = > ( kw = ' < ' kw = ' < ' ) )
{ // InternalXbase . g : 1039:5 : ( ( ( ' < ' ' < ' ) ) = > ( kw = ' < ' kw = ' < ' ) )
// InternalXbase . g : 1040:6 : ( ( ' < ' ' < ' ) ) = > ( kw = ' < ' kw = ' < ' )
{ // InternalXbase . g : 1045:6 : ( kw = ' < ' kw = ' < ' )
// InternalXbase . g : 1046:7 : kw = ' < ' kw = ' < '
{ kw = ( Token ) match ( input , 19 , FOLLOW_6 ) ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { current . merge ( kw ) ; newLeafNode ( kw , grammarAccess . getOpOtherAccess ( ) . getLessThanSignKeyword_6_1_0_0_0 ( ) ) ; } kw = ( Token ) match ( input , 19 , FOLLOW_2 ) ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { current . merge ( kw ) ; newLeafNode ( kw , grammarAccess . getOpOtherAccess ( ) . getLessThanSignKeyword_6_1_0_0_1 ( ) ) ; } } } } break ; case 2 : // InternalXbase . g : 1059:5 : kw = ' < '
{ kw = ( Token ) match ( input , 19 , FOLLOW_2 ) ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { current . merge ( kw ) ; newLeafNode ( kw , grammarAccess . getOpOtherAccess ( ) . getLessThanSignKeyword_6_1_1 ( ) ) ; } } break ; case 3 : // InternalXbase . g : 1065:5 : kw = ' = > '
{ kw = ( Token ) match ( input , 32 , FOLLOW_2 ) ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { current . merge ( kw ) ; newLeafNode ( kw , grammarAccess . getOpOtherAccess ( ) . getEqualsSignGreaterThanSignKeyword_6_1_2 ( ) ) ; } } break ; } } } break ; case 8 : // InternalXbase . g : 1073:3 : kw = ' < > '
{ kw = ( Token ) match ( input , 33 , FOLLOW_2 ) ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { current . merge ( kw ) ; newLeafNode ( kw , grammarAccess . getOpOtherAccess ( ) . getLessThanSignGreaterThanSignKeyword_7 ( ) ) ; } } break ; case 9 : // InternalXbase . g : 1079:3 : kw = ' ? : '
{ kw = ( Token ) match ( input , 34 , FOLLOW_2 ) ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { current . merge ( kw ) ; newLeafNode ( kw , grammarAccess . getOpOtherAccess ( ) . getQuestionMarkColonKeyword_8 ( ) ) ; } } break ; } } if ( state . backtracking == 0 ) { leaveRule ( ) ; } } catch ( RecognitionException re ) { recover ( input , re ) ; appendSkippedTokens ( ) ; } finally { } return current ; |
public class ReadStreamOld { /** * Writes < code > len < code > bytes to the output stream from this stream .
* @ param os destination stream .
* @ param len bytes to write . */
public void writeToStream ( OutputStream os , int len ) throws IOException { } } | while ( len > 0 ) { if ( _readLength <= _readOffset ) { if ( ! readBuffer ( ) ) return ; } int sublen = Math . min ( len , _readLength - _readOffset ) ; os . write ( _readBuffer , _readOffset , sublen ) ; _readOffset += sublen ; len -= sublen ; } |
public class RunService { /** * checkAllContainers : false = only running containers are considered */
private String findContainerId ( String imageNameOrAlias , boolean checkAllContainers ) throws DockerAccessException { } } | String id = lookupContainer ( imageNameOrAlias ) ; // check for external container . The image name is interpreted as a * container name * for that case . . .
if ( id == null ) { Container container = queryService . getContainer ( imageNameOrAlias ) ; if ( container != null && ( checkAllContainers || container . isRunning ( ) ) ) { id = container . getId ( ) ; } } return id ; |
public class LiteralExpr { /** * Object expr support . */
@ Override public String toObjectExpr ( String columnName ) { } } | if ( _value == null ) { return "null" ; } else if ( _value instanceof String ) { return "'" + _value + "'" ; } else { return String . valueOf ( _value ) ; } |
public class SimpleLoader { /** * Adds the class of this resource . */
@ Override protected void buildClassPath ( ArrayList < String > pathList ) { } } | String path = null ; if ( _path instanceof JarPath ) path = ( ( JarPath ) _path ) . getContainer ( ) . getNativePath ( ) ; else if ( _path . isDirectory ( ) ) path = _path . getNativePath ( ) ; if ( path != null && ! pathList . contains ( path ) ) pathList . add ( path ) ; |
public class CreateEndpointRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( CreateEndpointRequest createEndpointRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( createEndpointRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( createEndpointRequest . getEndpointIdentifier ( ) , ENDPOINTIDENTIFIER_BINDING ) ; protocolMarshaller . marshall ( createEndpointRequest . getEndpointType ( ) , ENDPOINTTYPE_BINDING ) ; protocolMarshaller . marshall ( createEndpointRequest . getEngineName ( ) , ENGINENAME_BINDING ) ; protocolMarshaller . marshall ( createEndpointRequest . getUsername ( ) , USERNAME_BINDING ) ; protocolMarshaller . marshall ( createEndpointRequest . getPassword ( ) , PASSWORD_BINDING ) ; protocolMarshaller . marshall ( createEndpointRequest . getServerName ( ) , SERVERNAME_BINDING ) ; protocolMarshaller . marshall ( createEndpointRequest . getPort ( ) , PORT_BINDING ) ; protocolMarshaller . marshall ( createEndpointRequest . getDatabaseName ( ) , DATABASENAME_BINDING ) ; protocolMarshaller . marshall ( createEndpointRequest . getExtraConnectionAttributes ( ) , EXTRACONNECTIONATTRIBUTES_BINDING ) ; protocolMarshaller . marshall ( createEndpointRequest . getKmsKeyId ( ) , KMSKEYID_BINDING ) ; protocolMarshaller . marshall ( createEndpointRequest . getTags ( ) , TAGS_BINDING ) ; protocolMarshaller . marshall ( createEndpointRequest . getCertificateArn ( ) , CERTIFICATEARN_BINDING ) ; protocolMarshaller . marshall ( createEndpointRequest . getSslMode ( ) , SSLMODE_BINDING ) ; protocolMarshaller . marshall ( createEndpointRequest . getServiceAccessRoleArn ( ) , SERVICEACCESSROLEARN_BINDING ) ; protocolMarshaller . marshall ( createEndpointRequest . getExternalTableDefinition ( ) , EXTERNALTABLEDEFINITION_BINDING ) ; protocolMarshaller . marshall ( createEndpointRequest . getDynamoDbSettings ( ) , DYNAMODBSETTINGS_BINDING ) ; protocolMarshaller . marshall ( createEndpointRequest . getS3Settings ( ) , S3SETTINGS_BINDING ) ; protocolMarshaller . marshall ( createEndpointRequest . getDmsTransferSettings ( ) , DMSTRANSFERSETTINGS_BINDING ) ; protocolMarshaller . marshall ( createEndpointRequest . getMongoDbSettings ( ) , MONGODBSETTINGS_BINDING ) ; protocolMarshaller . marshall ( createEndpointRequest . getKinesisSettings ( ) , KINESISSETTINGS_BINDING ) ; protocolMarshaller . marshall ( createEndpointRequest . getElasticsearchSettings ( ) , ELASTICSEARCHSETTINGS_BINDING ) ; protocolMarshaller . marshall ( createEndpointRequest . getRedshiftSettings ( ) , REDSHIFTSETTINGS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class Viennet3 { /** * Evaluate ( ) method */
@ Override public void evaluate ( DoubleSolution solution ) { } } | int numberOfVariables = getNumberOfVariables ( ) ; double [ ] f = new double [ getNumberOfObjectives ( ) ] ; double [ ] x = new double [ numberOfVariables ] ; for ( int i = 0 ; i < numberOfVariables ; i ++ ) { x [ i ] = solution . getVariableValue ( i ) ; } f [ 0 ] = 0.5 * ( x [ 0 ] * x [ 0 ] + x [ 1 ] * x [ 1 ] ) + Math . sin ( x [ 0 ] * x [ 0 ] + x [ 1 ] * x [ 1 ] ) ; // Second function
double value1 = 3.0 * x [ 0 ] - 2.0 * x [ 1 ] + 4.0 ; double value2 = x [ 0 ] - x [ 1 ] + 1.0 ; f [ 1 ] = ( value1 * value1 ) / 8.0 + ( value2 * value2 ) / 27.0 + 15.0 ; // Third function
f [ 2 ] = 1.0 / ( x [ 0 ] * x [ 0 ] + x [ 1 ] * x [ 1 ] + 1 ) - 1.1 * Math . exp ( - ( x [ 0 ] * x [ 0 ] ) - ( x [ 1 ] * x [ 1 ] ) ) ; for ( int i = 0 ; i < getNumberOfObjectives ( ) ; i ++ ) solution . setObjective ( i , f [ i ] ) ; |
public class SQLite { /** * Get the name that the column was { @ link # alias ( String ) aliased } to . */
public static String aliased ( String column ) { } } | int i = column . lastIndexOf ( '.' ) ; return i >= 0 ? column . substring ( i + 1 ) : column ; |
public class GraphiteHttpWriter { /** * Send given metrics to the Graphite server . */
@ Override public void write ( Iterable < QueryResult > results ) { } } | logger . debug ( "Export to '{}' results {}" , graphiteHttpUrl , results ) ; HttpURLConnection urlConnection = null ; OutputStreamWriter urlWriter ; try { StringBuilder sbUrlWriter = new StringBuilder ( "" ) ; for ( QueryResult result : results ) { String msg = metricPathPrefix + result . getName ( ) + " " + result . getValue ( ) + " " + result . getEpoch ( TimeUnit . SECONDS ) + "\n" ; logger . debug ( "Export '{}'" , msg ) ; sbUrlWriter . append ( msg ) ; } if ( sbUrlWriter . length ( ) > 0 ) { sbUrlWriter . insert ( 0 , "data=" ) ; urlConnection = ( HttpURLConnection ) graphiteHttpUrl . openConnection ( ) ; urlConnection . setRequestMethod ( "POST" ) ; urlConnection . setDoOutput ( true ) ; urlWriter = new OutputStreamWriter ( urlConnection . getOutputStream ( ) , Charset . forName ( "UTF-8" ) ) ; urlWriter . write ( sbUrlWriter . toString ( ) ) ; urlWriter . flush ( ) ; IoUtils2 . closeQuietly ( urlWriter ) ; int responseCode = urlConnection . getResponseCode ( ) ; if ( responseCode != 200 ) { logger . warn ( "Failure {}:'{}' to send result to Graphite HTTP proxy'{}' " , responseCode , urlConnection . getResponseMessage ( ) , graphiteHttpUrl ) ; } if ( logger . isTraceEnabled ( ) ) { IoUtils2 . copy ( urlConnection . getInputStream ( ) , System . out ) ; } } } catch ( Exception e ) { logger . warn ( "Failure to send result to Graphite HTTP proxy '{}'" , graphiteHttpUrl , e ) ; } finally { // Release the connection .
if ( urlConnection != null ) { try { InputStream in = urlConnection . getInputStream ( ) ; IoUtils2 . copy ( in , IoUtils2 . nullOutputStream ( ) ) ; IoUtils2 . closeQuietly ( in ) ; InputStream err = urlConnection . getErrorStream ( ) ; if ( err != null ) { IoUtils2 . copy ( err , IoUtils2 . nullOutputStream ( ) ) ; IoUtils2 . closeQuietly ( err ) ; } } catch ( IOException e ) { logger . warn ( "Exception flushing http connection" , e ) ; } } } |
public class DNSInput { /** * Reads a byte array of a specified length from the stream .
* @ return The byte array .
* @ throws WireParseException The end of the stream was reached . */
public byte [ ] readByteArray ( int len ) throws WireParseException { } } | require ( len ) ; byte [ ] out = new byte [ len ] ; System . arraycopy ( array , pos , out , 0 , len ) ; pos += len ; return out ; |
public class JasperUtil { /** * ( a subreport can also have subreports , not just the master ! ) */
public static void renameSubreportsInMaster ( List < JcrFile > jasperFiles , String id ) { } } | if ( jasperFiles . size ( ) > 1 ) { JcrFile masterFile = jasperFiles . get ( 0 ) ; try { String masterContent = new String ( masterFile . getDataProvider ( ) . getBytes ( ) , "UTF-8" ) ; List < String > subreportsContent = new ArrayList < String > ( ) ; for ( int i = 1 , size = jasperFiles . size ( ) ; i < size ; i ++ ) { subreportsContent . add ( new String ( jasperFiles . get ( i ) . getDataProvider ( ) . getBytes ( ) , "UTF-8" ) ) ; } for ( int i = 1 , size = jasperFiles . size ( ) ; i < size ; i ++ ) { String name = jasperFiles . get ( i ) . getName ( ) ; String oldName = FilenameUtils . getBaseName ( name ) + "." + JASPER_COMPILED_EXT ; String newName = getUnique ( name , id ) + "." + JASPER_COMPILED_EXT ; masterContent = masterContent . replaceAll ( oldName , newName ) ; for ( int j = 1 ; j < size ; j ++ ) { if ( j != i ) { subreportsContent . set ( j - 1 , subreportsContent . get ( j - 1 ) . replaceAll ( oldName , newName ) ) ; } } if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "Subreport " + name + ": " + oldName + " > " + newName ) ; // LOG . debug ( " master = " + master ) ;
} } masterFile . setDataProvider ( new JcrDataProviderImpl ( masterContent . getBytes ( "UTF-8" ) ) ) ; for ( int i = 1 , size = jasperFiles . size ( ) ; i < size ; i ++ ) { jasperFiles . get ( i ) . setDataProvider ( new JcrDataProviderImpl ( subreportsContent . get ( i - 1 ) . getBytes ( "UTF-8" ) ) ) ; } } catch ( UnsupportedEncodingException e ) { LOG . error ( "Error inside JasperUtil.renameSubreportsInMaster: " + e . getMessage ( ) , e ) ; e . printStackTrace ( ) ; } } |
public class FastStringComparator { /** * Compares two strings ( not lexicographically ) . */
@ Override public int compare ( String s1 , String s2 ) { } } | if ( s1 == s2 ) { // NOSONAR false - positive : Compare Objects With Equals
return 0 ; } int h1 = s1 . hashCode ( ) ; int h2 = s2 . hashCode ( ) ; if ( h1 < h2 ) { return - 1 ; } else if ( h1 > h2 ) { return 1 ; } else { return s1 . compareTo ( s2 ) ; } |
public class AWSCognitoIdentityProviderClient { /** * Updates the specified user pool app client with the specified attributes . If you don ' t provide a value for an
* attribute , it will be set to the default value . You can get a list of the current user pool app client settings
* with .
* @ param updateUserPoolClientRequest
* Represents the request to update the user pool client .
* @ return Result of the UpdateUserPoolClient operation returned by the service .
* @ throws ResourceNotFoundException
* This exception is thrown when the Amazon Cognito service cannot find the requested resource .
* @ throws InvalidParameterException
* This exception is thrown when the Amazon Cognito service encounters an invalid parameter .
* @ throws ConcurrentModificationException
* This exception is thrown if two or more modifications are happening concurrently .
* @ throws TooManyRequestsException
* This exception is thrown when the user has made too many requests for a given operation .
* @ throws NotAuthorizedException
* This exception is thrown when a user is not authorized .
* @ throws ScopeDoesNotExistException
* This exception is thrown when the specified scope does not exist .
* @ throws InvalidOAuthFlowException
* This exception is thrown when the specified OAuth flow is invalid .
* @ throws InternalErrorException
* This exception is thrown when Amazon Cognito encounters an internal error .
* @ sample AWSCognitoIdentityProvider . UpdateUserPoolClient
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / cognito - idp - 2016-04-18 / UpdateUserPoolClient "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public UpdateUserPoolClientResult updateUserPoolClient ( UpdateUserPoolClientRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeUpdateUserPoolClient ( request ) ; |
public class CommonG { /** * Generates the request based on the type of request , the end point , the data and type passed
* @ param requestType type of request to be sent
* @ param secure type of protocol
* @ param user user to be used in request
* @ param password password to be used in request
* @ param endPoint end point to sent the request to
* @ param data to be sent for PUT / POST requests
* @ param type type of data to be sent ( json | string )
* @ throws Exception exception */
public Future < Response > generateRequest ( String requestType , boolean secure , String user , String password , String endPoint , String data , String type ) throws Exception { } } | String protocol = this . getRestProtocol ( ) ; Future < Response > response = null ; BoundRequestBuilder request ; Realm realm = null ; if ( this . getRestHost ( ) == null ) { throw new Exception ( "Rest host has not been set" ) ; } if ( this . getRestPort ( ) == null ) { throw new Exception ( "Rest port has not been set" ) ; } if ( this . getRestProtocol ( ) == null ) { protocol = "http://" ; } String restURL = protocol + this . getRestHost ( ) + this . getRestPort ( ) ; // Setup user and password for requests
if ( user != null ) { realm = new Realm . RealmBuilder ( ) . setPrincipal ( user ) . setPassword ( password ) . setUsePreemptiveAuth ( true ) . setScheme ( AuthScheme . BASIC ) . build ( ) ; } switch ( requestType . toUpperCase ( ) ) { case "GET" : request = this . getClient ( ) . prepareGet ( restURL + endPoint ) ; if ( "json" . equals ( type ) ) { request = request . setHeader ( "Content-Type" , "application/json; charset=UTF-8" ) ; } else if ( "string" . equals ( type ) ) { this . getLogger ( ) . debug ( "Sending request as: {}" , type ) ; request = request . setHeader ( "Content-Type" , "application/x-www-form-urlencoded; charset=UTF-8" ) ; } else if ( "gov" . equals ( type ) ) { request = request . setHeader ( "Content-Type" , "application/json; charset=UTF-8" ) ; request = request . setHeader ( "Accept" , "application/json" ) ; request = request . setHeader ( "X-TenantID" , "NONE" ) ; } if ( this . getResponse ( ) != null ) { this . getLogger ( ) . debug ( "Reusing coookies: {}" , this . getResponse ( ) . getCookies ( ) ) ; request = request . setCookies ( this . getResponse ( ) . getCookies ( ) ) ; } for ( Cookie cook : this . getCookies ( ) ) { request = request . addCookie ( cook ) ; } if ( this . getSeleniumCookies ( ) . size ( ) > 0 ) { for ( org . openqa . selenium . Cookie cookie : this . getSeleniumCookies ( ) ) { request . addCookie ( new Cookie ( cookie . getName ( ) , cookie . getValue ( ) , false , cookie . getDomain ( ) , cookie . getPath ( ) , 99 , false , false ) ) ; } } if ( ! this . headers . isEmpty ( ) ) { for ( Map . Entry < String , String > header : headers . entrySet ( ) ) { request = request . setHeader ( header . getKey ( ) , header . getValue ( ) ) ; } } if ( user != null ) { request = request . setRealm ( realm ) ; } response = request . execute ( ) ; break ; case "DELETE" : if ( data == "" ) { request = this . getClient ( ) . prepareDelete ( restURL + endPoint ) ; if ( "gov" . equals ( type ) ) { request = request . setHeader ( "Content-Type" , "application/json; charset=UTF-8" ) ; request = request . setHeader ( "Accept" , "application/json" ) ; request = request . setHeader ( "X-TenantID" , "NONE" ) ; } } else { request = this . getClient ( ) . prepareDelete ( restURL + endPoint ) . setBody ( data ) ; if ( "json" . equals ( type ) ) { request = request . setHeader ( "Content-Type" , "application/json; charset=UTF-8" ) ; } else if ( "string" . equals ( type ) ) { this . getLogger ( ) . debug ( "Sending request as: {}" , type ) ; request = request . setHeader ( "Content-Type" , "application/x-www-form-urlencoded; charset=UTF-8" ) ; } else if ( "gov" . equals ( type ) ) { request = request . setHeader ( "Content-Type" , "application/json; charset=UTF-8" ) ; request = request . setHeader ( "Accept" , "application/json" ) ; request = request . setHeader ( "X-TenantID" , "NONE" ) ; } } if ( this . getSeleniumCookies ( ) . size ( ) > 0 ) { for ( org . openqa . selenium . Cookie cookie : this . getSeleniumCookies ( ) ) { request . addCookie ( new Cookie ( cookie . getName ( ) , cookie . getValue ( ) , false , cookie . getDomain ( ) , cookie . getPath ( ) , 99 , false , false ) ) ; } } for ( Cookie cook : this . getCookies ( ) ) { request = request . addCookie ( cook ) ; } if ( ! this . headers . isEmpty ( ) ) { for ( Map . Entry < String , String > header : headers . entrySet ( ) ) { request = request . setHeader ( header . getKey ( ) , header . getValue ( ) ) ; } } if ( user != null ) { request = request . setRealm ( realm ) ; } if ( data == "" ) { response = request . execute ( ) ; } else { response = this . getClient ( ) . executeRequest ( request . build ( ) ) ; } break ; case "POST" : if ( data == null ) { Exception missingFields = new Exception ( "Missing fields in request." ) ; throw missingFields ; } else { request = this . getClient ( ) . preparePost ( restURL + endPoint ) . setBody ( data ) ; if ( "json" . equals ( type ) ) { request = request . setHeader ( "Content-Type" , "application/json; charset=UTF-8" ) ; } else if ( "string" . equals ( type ) ) { this . getLogger ( ) . debug ( "Sending request as: {}" , type ) ; request = request . setHeader ( "Content-Type" , "application/x-www-form-urlencoded; charset=UTF-8" ) ; } else if ( "gov" . equals ( type ) ) { request = request . setHeader ( "Content-Type" , "application/json; charset=UTF-8" ) ; request = request . setHeader ( "Accept" , "application/json" ) ; request = request . setHeader ( "X-TenantID" , "NONE" ) ; } if ( this . getResponse ( ) != null ) { request = request . setCookies ( this . getResponse ( ) . getCookies ( ) ) ; } if ( this . getSeleniumCookies ( ) . size ( ) > 0 ) { for ( org . openqa . selenium . Cookie cookie : this . getSeleniumCookies ( ) ) { request . addCookie ( new Cookie ( cookie . getName ( ) , cookie . getValue ( ) , false , cookie . getDomain ( ) , cookie . getPath ( ) , 99 , false , false ) ) ; } } for ( Cookie cook : this . getCookies ( ) ) { request = request . addCookie ( cook ) ; } if ( ! this . headers . isEmpty ( ) ) { for ( Map . Entry < String , String > header : headers . entrySet ( ) ) { request = request . setHeader ( header . getKey ( ) , header . getValue ( ) ) ; } } if ( user != null ) { request = request . setRealm ( realm ) ; } response = this . getClient ( ) . executeRequest ( request . build ( ) ) ; break ; } case "PUT" : if ( data == null ) { Exception missingFields = new Exception ( "Missing fields in request." ) ; throw missingFields ; } else { request = this . getClient ( ) . preparePut ( restURL + endPoint ) . setBody ( data ) ; if ( "json" . equals ( type ) ) { request = request . setHeader ( "Content-Type" , "application/json; charset=UTF-8" ) ; } else if ( "string" . equals ( type ) ) { request = request . setHeader ( "Content-Type" , "application/x-www-form-urlencoded; charset=UTF-8" ) ; } else if ( "gov" . equals ( type ) ) { request = request . setHeader ( "Content-Type" , "application/json; charset=UTF-8" ) ; request = request . setHeader ( "Accept" , "application/json" ) ; request = request . setHeader ( "X-TenantID" , "NONE" ) ; } if ( this . getResponse ( ) != null ) { request = request . setCookies ( this . getResponse ( ) . getCookies ( ) ) ; } if ( this . getSeleniumCookies ( ) . size ( ) > 0 ) { for ( org . openqa . selenium . Cookie cookie : this . getSeleniumCookies ( ) ) { request . addCookie ( new Cookie ( cookie . getName ( ) , cookie . getValue ( ) , false , cookie . getDomain ( ) , cookie . getPath ( ) , 99 , false , false ) ) ; } } for ( Cookie cook : this . getCookies ( ) ) { request = request . addCookie ( cook ) ; } if ( ! this . headers . isEmpty ( ) ) { for ( Map . Entry < String , String > header : headers . entrySet ( ) ) { request = request . setHeader ( header . getKey ( ) , header . getValue ( ) ) ; } } if ( user != null ) { request = request . setRealm ( realm ) ; } response = this . getClient ( ) . executeRequest ( request . build ( ) ) ; break ; } case "CONNECT" : case "PATCH" : case "HEAD" : case "OPTIONS" : case "REQUEST" : case "TRACE" : throw new Exception ( "Operation not implemented: " + requestType ) ; default : throw new Exception ( "Operation not valid: " + requestType ) ; } return response ; |
public class NumberUtils { /** * < p > Gets the minimum of three < code > int < / code > values . < / p >
* @ param a value 1
* @ param b value 2
* @ param c value 3
* @ return the smallest of the values */
public static int min ( int a , final int b , final int c ) { } } | if ( b < a ) { a = b ; } if ( c < a ) { a = c ; } return a ; |
public class A_CmsSelectWidget { /** * Gets the resource path for the given dialog . < p >
* @ param cms TODO
* @ param dialog the dialog
* @ return the resource path */
protected String getResourcePath ( CmsObject cms , I_CmsWidgetDialog dialog ) { } } | String result = null ; if ( dialog instanceof CmsDummyWidgetDialog ) { result = ( ( CmsDummyWidgetDialog ) dialog ) . getResource ( ) . getRootPath ( ) ; } else if ( dialog instanceof CmsDialog ) { result = ( ( CmsDialog ) dialog ) . getParamResource ( ) ; if ( result != null ) { result = cms . getRequestContext ( ) . addSiteRoot ( result ) ; } } return result ; |
public class WSubordinateControlRenderer { /** * Helper method to determine the action name .
* @ param type the enumerated ActionType
* @ return the name of the action */
private String getActionTypeName ( final ActionType type ) { } } | String action = null ; switch ( type ) { case SHOW : action = "show" ; break ; case SHOWIN : action = "showIn" ; break ; case HIDE : action = "hide" ; break ; case HIDEIN : action = "hideIn" ; break ; case ENABLE : action = "enable" ; break ; case ENABLEIN : action = "enableIn" ; break ; case DISABLE : action = "disable" ; break ; case DISABLEIN : action = "disableIn" ; break ; case OPTIONAL : action = "optional" ; break ; case MANDATORY : action = "mandatory" ; break ; default : break ; } return action ; |
public class WakeUpSbb { /** * ( non - Javadoc )
* @ see javax . slee . Sbb # setSbbContext ( javax . slee . SbbContext ) */
public void setSbbContext ( SbbContext context ) { } } | // save the sbb context in a field
this . sbbContext = context ; // get the tracer if needed
this . tracer = context . getTracer ( WakeUpSbb . class . getSimpleName ( ) ) ; // get jndi environment stuff
try { final Context myEnv = ( Context ) new InitialContext ( ) ; // slee facilities
this . timerFacility = ( TimerFacility ) myEnv . lookup ( TimerFacility . JNDI_NAME ) ; this . nullACIFactory = ( NullActivityContextInterfaceFactory ) myEnv . lookup ( NullActivityContextInterfaceFactory . JNDI_NAME ) ; this . nullActivityFactory = ( NullActivityFactory ) myEnv . lookup ( NullActivityFactory . JNDI_NAME ) ; // the sbb interface to interact with SIP resource adaptor
this . sipProvider = ( SleeSipProvider ) myEnv . lookup ( "java:comp/env/slee/resources/jainsip/1.2/provider" ) ; } catch ( Exception e ) { tracer . severe ( "Failed to set sbb context" , e ) ; } |
public class ReservedDBInstance { /** * The recurring price charged to run this reserved DB instance .
* @ param recurringCharges
* The recurring price charged to run this reserved DB instance . */
public void setRecurringCharges ( java . util . Collection < RecurringCharge > recurringCharges ) { } } | if ( recurringCharges == null ) { this . recurringCharges = null ; return ; } this . recurringCharges = new com . amazonaws . internal . SdkInternalList < RecurringCharge > ( recurringCharges ) ; |
public class KubernetesMessage { /** * Response generating instantiation .
* @ param command
* @ param action
* @ param result
* @ return */
public static KubernetesMessage response ( String command , Watcher . Action action , KubernetesResource < ? > result ) { } } | KubernetesResponse response = new KubernetesResponse ( ) ; response . setCommand ( command ) ; response . setResult ( result ) ; response . setAction ( action . name ( ) ) ; return new KubernetesMessage ( response ) ; |
public class BusItinerary { /** * Replies the halt at the specified index .
* @ param index the index .
* @ return a bus halt */
@ Pure public BusItineraryHalt getBusHaltAt ( int index ) { } } | if ( index < this . validHalts . size ( ) ) { return this . validHalts . get ( index ) ; } return this . invalidHalts . get ( index - this . validHalts . size ( ) ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.