signature
stringlengths 43
39.1k
| implementation
stringlengths 0
450k
|
|---|---|
public class ListRuleGroupsResult { /** * An array of < a > RuleGroup < / a > objects .
* @ param ruleGroups
* An array of < a > RuleGroup < / a > objects . */
public void setRuleGroups ( java . util . Collection < RuleGroupSummary > ruleGroups ) { } }
|
if ( ruleGroups == null ) { this . ruleGroups = null ; return ; } this . ruleGroups = new java . util . ArrayList < RuleGroupSummary > ( ruleGroups ) ;
|
public class UniqueIDUtils { /** * The UUID for this incarnation of ME is generated
* using the hashcode of this object and the least
* significant four bytes of the current time in
* milliseconds .
* @ param caller The calling object used in the generation of the incarnation UUID
* @ return The generated incarnation UUID */
public static String generateIncUuid ( Object caller ) { } }
|
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "generateIncUuid" , "Caller=" + caller ) ; java . util . Date time = new java . util . Date ( ) ; int hash = caller . hashCode ( ) ; long millis = time . getTime ( ) ; byte [ ] data = new byte [ ] { ( byte ) ( hash >> 24 ) , ( byte ) ( hash >> 16 ) , ( byte ) ( hash >> 8 ) , ( byte ) ( hash ) , ( byte ) ( millis >> 24 ) , ( byte ) ( millis >> 16 ) , ( byte ) ( millis >> 8 ) , ( byte ) ( millis ) } ; String digits = "0123456789ABCDEF" ; StringBuffer retval = new StringBuffer ( data . length * 2 ) ; for ( int i = 0 ; i < data . length ; i ++ ) { retval . append ( digits . charAt ( ( data [ i ] >> 4 ) & 0xf ) ) ; retval . append ( digits . charAt ( data [ i ] & 0xf ) ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "generateIncUuid" , "return=" + retval ) ; return retval . toString ( ) ;
|
public class VAnnotationGrid { /** * Called whenever an update is received from the server */
@ Override public void updateFromUIDL ( UIDL uidl , ApplicationConnection client ) { } }
|
// This call should be made first .
// It handles sizes , captions , tooltips , etc . automatically .
if ( client . updateComponent ( this , uidl , true ) ) { // If client . updateComponent returns true there has been no changes and we
// do not need to update anything .
return ; } // Save reference to server connection object to be able to send
// user interaction later
this . gClient = client ; // Save the client side identifier ( paintable id ) for the widget
paintableId = uidl . getId ( ) ; try { if ( uidl . hasAttribute ( "escapeHTML" ) ) { this . escapeHTML = uidl . getBooleanAttribute ( "escapeHTML" ) ; } UIDL rows = uidl . getChildByTagName ( "rows" ) ; if ( rows != null ) { // clear all old table cells
table . removeAllRows ( ) ; highlighted . clear ( ) ; position2id . clear ( ) ; for ( int i = 0 ; i < rows . getChildCount ( ) ; i ++ ) { UIDL row = rows . getChildUIDL ( i ) ; if ( "row" . equals ( row . getTag ( ) ) ) { addRow ( row , i ) ; } } } // end if rows not null
// add end events if necessary to have a nicely aligned regular grid
int maxCellCount = 0 ; for ( int row = 0 ; row < table . getRowCount ( ) ; row ++ ) { maxCellCount = Math . max ( maxCellCount , getRealColumnCount ( row ) ) ; } for ( int row = 0 ; row < table . getRowCount ( ) ; row ++ ) { int isValue = getRealColumnCount ( row ) ; if ( isValue < maxCellCount ) { int diff = maxCellCount - isValue ; table . setHTML ( row , table . getCellCount ( row ) + diff - 1 , "" ) ; } } } catch ( Exception ex ) { Logger . getLogger ( VAnnotationGrid . class . getName ( ) ) . log ( Level . SEVERE , ex . getMessage ( ) , ex ) ; }
|
public class AABBd { /** * Set the maximum corner coordinates .
* @ param max
* the maximum coordinates
* @ return this */
public AABBd setMax ( Vector3dc max ) { } }
|
return this . setMax ( max . x ( ) , max . y ( ) , max . z ( ) ) ;
|
public class Model { /** * Sets attribute value as < code > Long < / code > .
* If there is a { @ link Converter } registered for the attribute that converts from Class < code > S < / code > to Class
* < code > java . lang . Long < / code > , given the value is an instance of < code > S < / code > , then it will be used ,
* otherwise performs a conversion using { @ link Convert # toLong ( Object ) } .
* @ param attributeName name of attribute .
* @ param value value
* @ return reference to this model . */
public < T extends Model > T setLong ( String attributeName , Object value ) { } }
|
Converter < Object , Long > converter = modelRegistryLocal . converterForValue ( attributeName , value , Long . class ) ; return setRaw ( attributeName , converter != null ? converter . convert ( value ) : Convert . toLong ( value ) ) ;
|
public class MinioClient { /** * Returns string map for given { @ link PostPolicy } to upload object with various post policy conditions .
* < / p > < b > Example : < / b > < br >
* < pre > { @ code / / Create new PostPolicy object for ' my - bucketname ' , ' my - objectname ' and 7 days expire time from now .
* PostPolicy policy = new PostPolicy ( " my - bucketname " , " my - objectname " , DateTime . now ( ) . plusDays ( 7 ) ) ;
* / / ' my - objectname ' should be ' image / png ' content type
* policy . setContentType ( " image / png " ) ;
* Map < String , String > formData = minioClient . presignedPostPolicy ( policy ) ;
* / / Print a curl command that can be executable with the file / tmp / userpic . png and the file will be uploaded .
* System . out . print ( " curl - X POST " ) ;
* for ( Map . Entry < String , String > entry : formData . entrySet ( ) ) {
* System . out . print ( " - F " + entry . getKey ( ) + " = " + entry . getValue ( ) ) ;
* System . out . println ( " - F file = @ / tmp / userpic . png https : / / play . min . io : 9000 / my - bucketname " ) ; } < / pre >
* @ param policy Post policy of an object .
* @ return Map of strings to construct form - data .
* @ throws InvalidBucketNameException upon invalid bucket name is given
* @ throws NoSuchAlgorithmException
* upon requested algorithm was not found during signature calculation
* @ throws InsufficientDataException upon getting EOFException while reading given
* InputStream even before reading given length
* @ throws IOException upon connection error
* @ throws InvalidKeyException
* upon an invalid access key or secret key
* @ throws NoResponseException upon no response from server
* @ throws XmlPullParserException upon parsing response xml
* @ throws ErrorResponseException upon unsuccessful execution
* @ throws InternalException upon internal library error
* @ throws InvalidArgumentException upon invalid value is passed to a method .
* @ see PostPolicy */
public Map < String , String > presignedPostPolicy ( PostPolicy policy ) throws InvalidBucketNameException , NoSuchAlgorithmException , InsufficientDataException , IOException , InvalidKeyException , NoResponseException , XmlPullParserException , ErrorResponseException , InternalException , InvalidArgumentException { } }
|
return policy . formData ( this . accessKey , this . secretKey , getRegion ( policy . bucketName ( ) ) ) ;
|
public class RegExp { /** * Builds a regular expression equivalent to the concatenation of
* several ( possibly more than 2 ) terms . In the normal case ,
* this method applies the binary < code > Concat < / code > constructor
* repeatedly . If the list of terms contains a single term , the
* method returns that term ( so , the resulting
* < code > RegExp < / code > is not always an instance of
* < code > Concat < / code > ) . If the list is empty , the method
* returns the < code > EmptyStr < / code > regexp . */
public static < A > RegExp < A > buildConcat ( List < RegExp < A > > concatTerms ) { } }
|
if ( concatTerms . isEmpty ( ) ) return new EmptyStr < A > ( ) ; Iterator < RegExp < A > > it = concatTerms . iterator ( ) ; RegExp < A > re = it . next ( ) ; while ( it . hasNext ( ) ) { re = new Concat < A > ( re , it . next ( ) ) ; } return re ;
|
public class WaveformPreviewComponent { /** * Converts a time in milliseconds to the appropriate x coordinate for drawing something at that time .
* Can only be called when we have { @ link TrackMetadata } .
* @ param milliseconds the time at which something should be drawn
* @ return the component x coordinate at which it should be drawn */
public int millisecondsToX ( long milliseconds ) { } }
|
if ( duration . get ( ) < 1 ) { // Don ' t crash if we are missing duration information .
return 0 ; } long result = milliseconds * waveformWidth ( ) / ( duration . get ( ) * 1000 ) ; return WAVEFORM_MARGIN + Math . max ( 0 , Math . min ( waveformWidth ( ) , ( int ) result ) ) ;
|
public class ScopInstallation { /** * / * ( non - Javadoc )
* @ see org . biojava . nbio . structure . scop . ScopDatabase # getDomainsForPDB ( java . lang . String ) */
@ Override public List < ScopDomain > getDomainsForPDB ( String pdbId ) { } }
|
try { ensureClaInstalled ( ) ; } catch ( IOException e ) { throw new ScopIOException ( e ) ; } List < ScopDomain > doms = domainMap . get ( pdbId . toLowerCase ( ) ) ; List < ScopDomain > retdoms = new ArrayList < ScopDomain > ( ) ; if ( doms == null ) return retdoms ; for ( ScopDomain d : doms ) { try { ScopDomain n = ( ScopDomain ) d . clone ( ) ; retdoms . add ( n ) ; } catch ( CloneNotSupportedException e ) { throw new RuntimeException ( ScopDomain . class + " subclass does not support clone()" , e ) ; } } return retdoms ;
|
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link LinkType }
* { @ code > } */
@ XmlElementDecl ( namespace = "http://www.w3.org/2005/Atom" , name = "link" , scope = SourceType . class ) public JAXBElement < LinkType > createSourceTypeLink ( LinkType value ) { } }
|
return new JAXBElement < LinkType > ( ENTRY_TYPE_LINK_QNAME , LinkType . class , SourceType . class , value ) ;
|
public class LuceneIndex { /** * Commits all changes to the index , waits for pending merges to complete , and closes all associated resources . */
public void close ( ) { } }
|
Log . info ( "Closing index" ) ; try { Log . info ( "Closing" ) ; searcherReopener . interrupt ( ) ; searcherManager . close ( ) ; indexWriter . close ( ) ; directory . close ( ) ; } catch ( IOException e ) { Log . error ( e , "Error while closing index" ) ; throw new RuntimeException ( e ) ; }
|
public class ResolvedTypes { /** * / * @ Nullable */
protected JvmTypeReference getDeclaredType ( JvmIdentifiableElement identifiable ) { } }
|
if ( identifiable instanceof JvmOperation ) { return ( ( JvmOperation ) identifiable ) . getReturnType ( ) ; } if ( identifiable instanceof JvmField ) { return ( ( JvmField ) identifiable ) . getType ( ) ; } if ( identifiable instanceof JvmConstructor ) { return shared . resolver . getServices ( ) . getTypeReferences ( ) . createTypeRef ( ( ( JvmConstructor ) identifiable ) . getDeclaringType ( ) ) ; } if ( identifiable instanceof JvmFormalParameter ) { JvmTypeReference parameterType = ( ( JvmFormalParameter ) identifiable ) . getParameterType ( ) ; return parameterType ; } return null ;
|
public class TypeUtility { /** * Checks if is enum .
* @ param className
* the class name
* @ return true , if is enum */
public static boolean isEnum ( String className ) { } }
|
try { // is it an enum ?
TypeElement element = BindTypeSubProcessor . elementUtils . getTypeElement ( className ) ; if ( element instanceof TypeElement ) { TypeElement typeElement = element ; TypeMirror superclass = typeElement . getSuperclass ( ) ; if ( superclass instanceof DeclaredType ) { DeclaredType superclassDeclaredType = ( DeclaredType ) superclass ; if ( JAVA_LANG_ENUM . equals ( getCanonicalTypeName ( superclassDeclaredType ) ) ) { return true ; } } } return false ; } catch ( Throwable e ) { return false ; }
|
public class HCalendarParser { /** * { @ inheritDoc } */
public void parse ( InputStream in , ContentHandler handler ) throws IOException , ParserException { } }
|
parse ( new InputSource ( in ) , handler ) ;
|
public class Retryer { /** * Runs until the retry duration is reached
* @ throws Exception if an error occurs */
public void run ( ) throws Exception { } }
|
// Send the initial command :
client . sendRequest ( cmd ) ; long endTime = System . currentTimeMillis ( ) + spec . getMaxDuration ( ) ; // Wait until the ' after ' time
Thread . sleep ( spec . getAfter ( ) ) ; int numAttempts = 0 ; long now = System . currentTimeMillis ( ) ; while ( now < endTime ) { client . sendRequest ( cmd ) ; now = System . currentTimeMillis ( ) ; numAttempts ++ ; // See how to retry :
long sleepTime = 0 ; if ( spec . isConstant ( ) ) { sleepTime = spec . getInterval ( ) ; } else if ( spec . isLinear ( ) ) { sleepTime = spec . getInterval ( ) * numAttempts ; } else if ( spec . isExponential ( ) ) { sleepTime = ( long ) Math . pow ( spec . getInterval ( ) , numAttempts ) ; } if ( spec . getCeil ( ) > 0 ) { sleepTime = Math . min ( spec . getCeil ( ) , sleepTime ) ; } if ( now + sleepTime > endTime ) { break ; } else { accuSleep ( sleepTime ) ; now = System . currentTimeMillis ( ) ; } }
|
public class ZipFileSliceReader { /** * Copy from an offset within the file into a byte [ ] array ( possibly spanning the boundary between two 2GB
* chunks ) .
* @ param off
* the offset
* @ param buf
* the buffer to copy into
* @ param bufStart
* the start index within the buffer
* @ param numBytesToRead
* the number of bytes to read
* @ return the number of bytes read
* @ throws IOException
* if an I / O exception occurs .
* @ throws InterruptedException
* if the thread was interrupted . */
int read ( final long off , final byte [ ] buf , final int bufStart , final int numBytesToRead ) throws IOException , InterruptedException { } }
|
if ( off < 0 || bufStart < 0 || bufStart + numBytesToRead > buf . length ) { throw new IndexOutOfBoundsException ( ) ; } int currBufStart = bufStart ; int remainingBytesToRead = numBytesToRead ; int totBytesRead = 0 ; for ( long currOff = off ; remainingBytesToRead > 0 ; ) { // Find the ByteBuffer chunk to read from
final long currOffAbsolute = zipFileSlice . startOffsetWithinPhysicalZipFile + currOff ; final int chunkIdx = ( int ) ( currOffAbsolute / FileUtils . MAX_BUFFER_SIZE ) ; final ByteBuffer chunk = getChunk ( chunkIdx ) ; final long chunkStartAbsolute = ( ( long ) chunkIdx ) * ( long ) FileUtils . MAX_BUFFER_SIZE ; final int startReadPos = ( int ) ( currOffAbsolute - chunkStartAbsolute ) ; // Read from current chunk .
// N . B . the cast to Buffer is necessary , see :
// https : / / github . com / plasma - umass / doppio / issues / 497 # issuecomment - 334740243
// https : / / github . com / classgraph / classgraph / issues / 284 # issuecomment - 443612800
// Otherwise compiling in JDK < 9 compatibility mode using JDK9 + causes runtime breakage .
( ( Buffer ) chunk ) . mark ( ) ; ( ( Buffer ) chunk ) . position ( startReadPos ) ; final int numBytesRead = Math . min ( chunk . remaining ( ) , remainingBytesToRead ) ; try { chunk . get ( buf , currBufStart , numBytesRead ) ; } catch ( final BufferUnderflowException e ) { // Should not happen
throw new EOFException ( "Unexpected EOF" ) ; } ( ( Buffer ) chunk ) . reset ( ) ; currOff += numBytesRead ; currBufStart += numBytesRead ; totBytesRead += numBytesRead ; remainingBytesToRead -= numBytesRead ; } return totBytesRead == 0 && numBytesToRead > 0 ? - 1 : totBytesRead ;
|
public class DeleteLagResult { /** * The connections bundled by the LAG .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setConnections ( java . util . Collection ) } or { @ link # withConnections ( java . util . Collection ) } if you want to
* override the existing values .
* @ param connections
* The connections bundled by the LAG .
* @ return Returns a reference to this object so that method calls can be chained together . */
public DeleteLagResult withConnections ( Connection ... connections ) { } }
|
if ( this . connections == null ) { setConnections ( new com . amazonaws . internal . SdkInternalList < Connection > ( connections . length ) ) ; } for ( Connection ele : connections ) { this . connections . add ( ele ) ; } return this ;
|
public class State { /** * 添加一个匹配到的模式串 ( 这个状态对应着这个模式串 )
* @ param keyword */
public void addEmit ( int keyword ) { } }
|
if ( this . emits == null ) { this . emits = new TreeSet < Integer > ( Collections . reverseOrder ( ) ) ; } this . emits . add ( keyword ) ;
|
public class StructuredQueryBuilder { /** * Matches an element , element pair , element attribute , pair , or path
* specifying a geospatial point that appears within one of the criteria regions .
* @ param index the container for the coordinates of the geospatial point
* @ param scope whether the query matches the document content or properties
* @ param options options for fine tuning the query
* @ param regions the possible regions containing the point
* @ return the StructuredQueryDefinition for the geospatial query */
public StructuredQueryDefinition geospatial ( GeospatialIndex index , FragmentScope scope , String [ ] options , Region ... regions ) { } }
|
checkRegions ( regions ) ; return new GeospatialPointQuery ( index , scope , regions , options ) ;
|
public class IfcStructuralLoadConfigurationImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ SuppressWarnings ( "unchecked" ) @ Override public EList < IfcStructuralLoadOrResult > getValues ( ) { } }
|
return ( EList < IfcStructuralLoadOrResult > ) eGet ( Ifc4Package . Literals . IFC_STRUCTURAL_LOAD_CONFIGURATION__VALUES , true ) ;
|
public class RepositoryMockAgent { /** * Modifies the belief referenced by bName parameter .
* @ param bName
* - the name of the belief to update .
* @ param value
* - the new value for the belief */
private void setBelief ( String bName , Object value ) { } }
|
introspector . setBeliefValue ( this . getLocalName ( ) , bName , value , null ) ;
|
public class CmsTinyMceToolbarHelper { /** * Helper method to generate a TinyMCE - specific toolbar configuration string from a list of generic toolbar button names . < p >
* @ param barItems the generic toolbar items
* @ return the TinyMCE toolbar configuration string */
public static String createTinyMceToolbarStringFromGenericToolbarItems ( List < String > barItems ) { } }
|
List < List < String > > blocks = new ArrayList < List < String > > ( ) ; blocks . add ( new ArrayList < String > ( ) ) ; String lastItem = null ; List < String > processedItems = new ArrayList < String > ( ) ; // translate buttons and eliminate adjacent separators
for ( String barItem : barItems ) { String translated = CmsTinyMceToolbarHelper . translateButton ( barItem ) ; if ( translated != null ) { barItem = translated ; } if ( barItem . equals ( "[" ) || barItem . equals ( "]" ) || barItem . equals ( "-" ) ) { barItem = "|" ; if ( "|" . equals ( lastItem ) ) { continue ; } } if ( barItem . indexOf ( "," ) > - 1 ) { for ( String subItem : barItem . split ( "," ) ) { processedItems . add ( subItem ) ; } } else { processedItems . add ( barItem ) ; } lastItem = barItem ; } // remove leading or trailing ' | '
if ( ( processedItems . size ( ) > 0 ) && processedItems . get ( 0 ) . equals ( "|" ) ) { processedItems . remove ( 0 ) ; } if ( ( processedItems . size ( ) > 0 ) && processedItems . get ( processedItems . size ( ) - 1 ) . equals ( "|" ) ) { processedItems . remove ( processedItems . size ( ) - 1 ) ; } Set < String > writtenItems = new HashSet < String > ( ) ; // transform flat list into list of groups
for ( String processedItem : processedItems ) { if ( ! writtenItems . contains ( processedItem ) ) { blocks . get ( blocks . size ( ) - 1 ) . add ( processedItem ) ; } if ( "|" . equals ( processedItem ) ) { blocks . add ( new ArrayList < String > ( ) ) ; } else { writtenItems . add ( processedItem ) ; } } // produce the TinyMCE toolbar options from the groups
// we use TinyMCE ' s button rows as groups instead of rows and fix the layout using CSS .
// This is because we want the button bars to wrap automatically when there is not enough space .
// Using this method , the wraps can only occur between different blocks / rows .
String toolbar = "" ; for ( List < String > block : blocks ) { toolbar += CmsStringUtil . listAsString ( block , " " ) + " " ; } return toolbar ;
|
public class CheckedDatastoreReaderWriter { /** * Prefer this method over { @ link # get ( Iterable ) } to avoid gathering large results in a list .
* @ see DatastoreReaderWriter # get ( Key . . . )
* @ throws IOException if the underlying client throws { @ link DatastoreException }
* or if { @ code f } throws { @ link IOException } . */
void get ( Iterable < Key > keys , IOConsumer < Entity > f ) throws IOException { } }
|
run ( ( ) -> rw . get ( toArray ( keys , Key . class ) ) . forEachRemaining ( IOConsumer . unchecked ( f ) ) ) ;
|
public class GuiUtils { /** * A useful helper for development purposes . Used as a switch for loading files from local disk , allowing live
* editing whilst the app runs without rebuilds . */
public static URL getResource ( String name ) { } }
|
if ( false ) return unchecked ( ( ) -> new URL ( "file:///your/path/here/src/main/wallettemplate/" + name ) ) ; else return MainController . class . getResource ( name ) ;
|
public class DBStripeStore { /** * Only used for testing */
public void dropTable ( ) throws IOException { } }
|
DBUtils . runInsert ( connectionFactory , DROP_TABLE_SQL , DBUtils . EMPTY_SQL_PARAMS , sqlNumRetries ) ; LOG . info ( "Drop table " + tblName ) ;
|
public class SparkClientFactory { /** * ( non - Javadoc )
* @ see
* com . impetus . kundera . loader . GenericClientFactory # initialize ( java . util . Map ) */
@ Override public void initialize ( Map < String , Object > puProperties ) { } }
|
reader = new SparkEntityReader ( kunderaMetadata ) ; setExternalProperties ( puProperties ) ; initializePropertyReader ( ) ; PersistenceUnitMetadata pum = kunderaMetadata . getApplicationMetadata ( ) . getPersistenceUnitMetadata ( getPersistenceUnit ( ) ) ; sparkconf = new SparkConf ( true ) ; configureClientProperties ( pum ) ; sparkContext = new SparkContext ( sparkconf ) ; sqlContext = new HiveContext ( sparkContext ) ;
|
public class ItemDeletion { /** * Register the supplied { @ link Item } for deletion .
* @ param item the { @ link Item } that is to be deleted .
* @ return { @ code true } if and only if the { @ link Item } was registered and the caller is now responsible to call
* { @ link # deregister ( Item ) } . */
public static boolean register ( @ Nonnull Item item ) { } }
|
ItemDeletion instance = instance ( ) ; if ( instance == null ) { return false ; } instance . lock . writeLock ( ) . lock ( ) ; try { return instance . registrations . add ( item ) ; } finally { instance . lock . writeLock ( ) . unlock ( ) ; }
|
public class Node { /** * Add or override a named attribute . < br / >
* < br / >
* value will be converted to String using String . valueOf ( value ) ;
* @ param name
* The attribute name
* @ param value
* The given value
* @ return This { @ link Node }
* @ see # attribute ( String , String ) */
public Node attribute ( final String name , final Object value ) { } }
|
return attribute ( name , String . valueOf ( value ) ) ;
|
public class ConfigurationContext { /** * Register commands resolved with classpath scan .
* @ param commands installed commands
* @ see ru . vyarus . dropwizard . guice . GuiceBundle . Builder # searchCommands ( ) */
public void registerCommands ( final List < Class < Command > > commands ) { } }
|
setScope ( ConfigScope . ClasspathScan . getType ( ) ) ; for ( Class < Command > cmd : commands ) { register ( ConfigItem . Command , cmd ) ; } closeScope ( ) ;
|
public class EndpointBuilder { /** * Builds an XML - PRC server that can be exposed via { @ link NanoServer } .
* Methods declared by < code > clazz < / code > should be annotated by
* { @ link XRMethod } .
* @ param server
* Java object implementing service
* @ param clazz
* declaring XML - RPC methods
* @ param < Z >
* server type
* @ return HTTP server endpoint */
@ SuppressWarnings ( { } }
|
"rawtypes" , "unchecked" } ) public < Z > EndpointBuilder < HTTPServerEndpoint > server ( Z server , Class < Z > clazz ) { return new EndpointBuilder ( server , clazz ) ;
|
public class DULogEntry { /** * Sets the data usage for a given attribute .
* @ param attribute The attribute ( data element ) for which the usage is
* specified .
* @ param dataUsage The usage of the data element specified by the given
* attribute .
* @ return < code > true < / code > if the data usage for the given attribute
* was modified ; < br >
* < code > false < / code > otherwise .
* @ throws ParameterException if the given attribute is
* < code > null < / code > or data usage is invalid ( < code > null < / code > or
* empty ) .
* @ throws LockingException if the corresponding field is locked < br >
* and the given data usage is not identical to the current one . */
public boolean setDataUsageFor ( DataAttribute attribute , Set < DataUsage > dataUsage ) throws ParameterException , LockingException { } }
|
Validate . notNull ( attribute ) ; Validate . notNull ( dataUsage ) ; Validate . notEmpty ( dataUsage ) ; if ( isFieldLocked ( EntryField . DATA ) ) { if ( ! ( this . dataUsage . containsKey ( attribute ) && this . dataUsage . get ( attribute ) . equals ( dataUsage ) ) ) { throw new LockingException ( EntryField . DATA ) ; } return false ; } else { this . dataUsage . put ( attribute , dataUsage ) ; return true ; }
|
public class CmsConfigurationReader { /** * Gets the string value of an XML content location . < p >
* @ param cms the CMS context to use
* @ param location an XML content location
* @ return the string value of that XML content location */
public static String getString ( CmsObject cms , I_CmsXmlContentValueLocation location ) { } }
|
if ( location == null ) { return null ; } return location . asString ( cms ) ;
|
public class RegularCyclicVertexSearch { /** * Build an indexed lookup of vertex color . The vertex color indicates which
* cycle a given vertex belongs . If a vertex belongs to more then one cycle
* it is colored ' 0 ' . If a vertex belongs to no cycle it is colored ' - 1 ' .
* @ return vertex colors */
private int [ ] buildVertexColor ( ) { } }
|
int [ ] color = new int [ g . length ] ; int n = 1 ; Arrays . fill ( color , - 1 ) ; for ( long cycle : cycles ) { for ( int i = 0 ; i < g . length ; i ++ ) { if ( ( cycle & 0x1 ) == 0x1 ) color [ i ] = color [ i ] < 0 ? n : 0 ; cycle >>= 1 ; } n ++ ; } return color ;
|
public class IOCImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public Object eGet ( int featureID , boolean resolve , boolean coreType ) { } }
|
switch ( featureID ) { case AfplibPackage . IOC__XOA_OSET : return getXoaOset ( ) ; case AfplibPackage . IOC__YOA_OSET : return getYoaOset ( ) ; case AfplibPackage . IOC__XOA_ORENT : return getXoaOrent ( ) ; case AfplibPackage . IOC__YOA_ORENT : return getYoaOrent ( ) ; case AfplibPackage . IOC__CON_DATA1 : return getConData1 ( ) ; case AfplibPackage . IOC__XMAP : return getXMap ( ) ; case AfplibPackage . IOC__YMAP : return getYMap ( ) ; case AfplibPackage . IOC__CON_DATA2 : return getConData2 ( ) ; } return super . eGet ( featureID , resolve , coreType ) ;
|
public class PcmWavConverter { /** * This method appends the passed in { @ link com . github . republicofgavin . pauseresumeaudiorecorder . conversion . PcmWavConverter . WaveHeader } to the beginning of the passed in
* . wav file . NOTE : To prevent data from being overwritten by this method , it is advisable to write some junk data that is the size of the wav header at the beginning of the file .
* This way , only the junk data is destroyed when you are ready to add the header to the finished file .
* @ param waveHeader A { @ link PcmWavConverter . WaveHeader } composed of the format of data location at the pcmFilePath . Cannot be null .
* @ param wavFilePath The absolute path to where the WAV file will be created . Directory path should already be created . String cannot be : null , empty , blank . It is recommended that the file have a . wav suffix .
* @ throws IllegalArgumentException If the parameters are invalid . */
public static void addWavHeader ( WaveHeader waveHeader , final String wavFilePath ) throws IOException { } }
|
if ( waveHeader == null ) { throw new IllegalArgumentException ( "waveHeader cannot be null" ) ; } if ( wavFilePath == null || wavFilePath . trim ( ) . isEmpty ( ) ) { throw new IllegalArgumentException ( "wavFilePath cannot be null, empty, blank" ) ; } RandomAccessFile randomAccessFile = new RandomAccessFile ( new File ( wavFilePath ) , "rw" ) ; randomAccessFile . seek ( 0L ) ; writeWavHeader ( waveHeader , randomAccessFile , new File ( wavFilePath ) ) ; randomAccessFile . close ( ) ;
|
public class RTreeIndexExtension { /** * { @ inheritDoc } */
@ Override public void createMaxXFunction ( ) { } }
|
createFunction ( MAX_X_FUNCTION , new GeometryFunction ( ) { @ Override public Object execute ( GeoPackageGeometryData data ) { Object value = null ; GeometryEnvelope envelope = getEnvelope ( data ) ; if ( envelope != null ) { value = envelope . getMaxX ( ) ; } return value ; } } ) ;
|
public class AssertKripton { /** * When a pojo has a valid constructor
* @ param expression
* @ param entity */
public static void assertTrueOfInvalidConstructor ( boolean expression , ModelClass < ? > entity ) { } }
|
if ( ! expression ) { String msg = String . format ( "Class '%s' has no constructor without parameters (to be a mutable class) or with all parameters (to be an immutable class)." , entity . getElement ( ) . getQualifiedName ( ) ) ; throw ( new InvalidDefinition ( msg ) ) ; }
|
public class InternalPureXbaseParser { /** * $ ANTLR start synpred17 _ InternalPureXbase */
public final void synpred17_InternalPureXbase_fragment ( ) throws RecognitionException { } }
|
// InternalPureXbase . g : 1714:6 : ( ( ' < ' ' < ' ) )
// InternalPureXbase . g : 1714:7 : ( ' < ' ' < ' )
{ // InternalPureXbase . g : 1714:7 : ( ' < ' ' < ' )
// InternalPureXbase . g : 1715:7 : ' < ' ' < '
{ match ( input , 28 , FOLLOW_17 ) ; if ( state . failed ) return ; match ( input , 28 , FOLLOW_2 ) ; if ( state . failed ) return ; } }
|
public class XMLUtil { /** * Replies the boolean value that corresponds to the specified attribute ' s path .
* < p > The path is an ordered list of tag ' s names and ended by the name of
* the attribute .
* @ param document is the XML document to explore .
* @ param caseSensitive indicates of the { @ code path } ' s components are case sensitive .
* @ param defaultValue is the default value to reply .
* @ param path is the list of and ended by the attribute ' s name .
* @ return the boolean value of the specified attribute or < code > false < / code > if
* it was node found in the document */
@ Pure public static Boolean getAttributeBooleanWithDefault ( Node document , boolean caseSensitive , Boolean defaultValue , String ... path ) { } }
|
assert document != null : AssertMessages . notNullParameter ( 0 ) ; final String v = getAttributeValue ( document , caseSensitive , 0 , path ) ; if ( v == null || v . isEmpty ( ) ) { return defaultValue ; } return CONSTANT_TRUE . equalsIgnoreCase ( v ) || CONSTANT_YES . equalsIgnoreCase ( v ) || CONSTANT_ON . equalsIgnoreCase ( v ) || CONSTANT_Y . equalsIgnoreCase ( v ) || CONSTANT_T . equalsIgnoreCase ( v ) ;
|
public class ArrayUtil { /** * concat 2 array to a new array .
* @ param first first array , can not be null
* @ param second second array , can not be null
* @ return the result array .
* @ deprecated This method can not cocat null object and only supports concating of 2 arrays . Use { @ link # concatV2 ( Class , Object [ ] [ ] ) } instead . */
public static < T > T [ ] concat ( T [ ] first , T [ ] second ) { } }
|
T [ ] result = Arrays . copyOf ( first , first . length + second . length ) ; System . arraycopy ( second , 0 , result , first . length , second . length ) ; return result ;
|
public class ThreadLocalSecureRandomUuidFactory { /** * / * package private */
static long toLong ( final byte [ ] buffer , final int offset ) { } }
|
final long value1 = toInt ( buffer , offset ) ; final long value2 = toInt ( buffer , offset + 4 ) ; return ( value1 << 32 ) + ( ( value2 << 32 ) >>> 32 ) ;
|
public class SraReader { /** * Read a study from the specified URL .
* @ param url URL , must not be null
* @ return a study read from the specified URL
* @ throws IOException if an I / O error occurs */
public static Study readStudy ( final URL url ) throws IOException { } }
|
checkNotNull ( url ) ; try ( BufferedReader reader = Resources . asCharSource ( url , Charsets . UTF_8 ) . openBufferedStream ( ) ) { return readStudy ( reader ) ; }
|
public class UIComponentTag { /** * Determine whether this component renders itself . A component is " suppressed " when it is either not rendered , or
* when it is rendered by its parent component at a time of the parent ' s choosing . */
protected boolean isSuppressed ( ) { } }
|
if ( _suppressed == null ) { // we haven ' t called this method before , so determine the suppressed
// value and cache it for later calls to this method .
if ( isFacet ( ) ) { // facets are always rendered by their parents - - > suppressed
_suppressed = Boolean . TRUE ; return true ; } UIComponent component = getComponentInstance ( ) ; // Does any parent render its children ?
// ( We must determine this first , before calling any isRendered method
// because rendered properties might reference a data var of a nesting UIData ,
// which is not set at this time , and would cause a VariableResolver error ! )
UIComponent parent = component . getParent ( ) ; while ( parent != null ) { if ( parent . getRendersChildren ( ) ) { // Yes , parent found , that renders children - - > suppressed
_suppressed = Boolean . TRUE ; return true ; } parent = parent . getParent ( ) ; } // does component or any parent has a false rendered attribute ?
while ( component != null ) { if ( ! component . isRendered ( ) ) { // Yes , component or any parent must not be rendered - - > suppressed
_suppressed = Boolean . TRUE ; return true ; } component = component . getParent ( ) ; } // else - - > not suppressed
_suppressed = Boolean . FALSE ; } return _suppressed . booleanValue ( ) ;
|
public class URBridge { /** * Set the mapping of RDN properties for each entity type . A map is created
* with the key as the entity type and the value as the RDN property to be used .
* This information is taken from the configuration .
* @ param configProps map containing the configuration information .
* @ throws WIMException throw when there is not a mapping for a user
* or not a mapping for a group . */
private void setConfigEntityMapping ( Map < String , Object > configProps ) throws WIMException { } }
|
List < String > entityTypes = getSupportedEntityTypes ( ) ; String rdnProp ; String type = null ; entityConfigMap = new HashMap < String , String > ( ) ; for ( int i = 0 ; i < entityTypes . size ( ) ; i ++ ) { type = entityTypes . get ( i ) ; rdnProp = ( getRDNProperties ( type ) == null ) ? null : getRDNProperties ( type ) [ 0 ] ; entityConfigMap . put ( type , rdnProp ) ; } if ( entityConfigMap . get ( Service . DO_LOGIN_ACCOUNT ) == null && entityConfigMap . get ( personAccountType ) != null ) entityConfigMap . put ( Service . DO_LOGIN_ACCOUNT , entityConfigMap . get ( personAccountType ) ) ; if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "setConfigEntityMapping entityConfigMap:" + entityConfigMap ) ;
|
public class HMModel { /** * Utility method to concatenate conditions with or .
* This can be useful for readability ( in case of negation ) .
* @ param statements a list of statements .
* @ return the final boolean from the or concatenation . */
protected boolean concatOr ( boolean ... statements ) { } }
|
boolean isTrue = statements [ 0 ] ; for ( int i = 1 ; i < statements . length ; i ++ ) { isTrue = isTrue || statements [ i ] ; } return isTrue ;
|
public class CmsSitemapView { /** * Returns the disabled state of the given model page entry . < p >
* @ param id the entry id
* @ return the disabled state */
public boolean isDisabledModelPageEntry ( CmsUUID id ) { } }
|
boolean result = false ; if ( m_modelPageTreeItems . containsKey ( id ) ) { result = m_modelPageTreeItems . get ( id ) . isDisabled ( ) ; } else if ( m_parentModelPageTreeItems . containsKey ( id ) ) { result = m_parentModelPageTreeItems . get ( id ) . isDisabled ( ) ; } return result ;
|
public class Util { /** * / * Utility function to override system default font with an font ttf file from asset . The override
* will be applied to the entire application . The ideal place to call this method is from the onCreate ( )
* of the Application .
* Usage : Util . replaceDefaultFont ( this , " Tinos - Regular . ttf " ) ;
* @ param context The application context the font override will be applied to
* @ param fontFilePath The file path to the font file in the assets directory */
public static void replaceDefaultFont ( Context context , String fontFilePath ) { } }
|
final Typeface newTypeface = Typeface . createFromAsset ( context . getAssets ( ) , fontFilePath ) ; TypedValue tv = new TypedValue ( ) ; String staticTypefaceFieldName = null ; Map < String , Typeface > newMap = null ; Resources . Theme apptentiveTheme = context . getResources ( ) . newTheme ( ) ; ApptentiveInternal . getInstance ( ) . updateApptentiveInteractionTheme ( context , apptentiveTheme ) ; if ( apptentiveTheme == null ) { return ; } if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . LOLLIPOP ) { if ( apptentiveTheme . resolveAttribute ( R . attr . apptentiveFontFamilyDefault , tv , true ) ) { newMap = new HashMap < String , Typeface > ( ) ; newMap . put ( tv . string . toString ( ) , newTypeface ) ; } if ( apptentiveTheme . resolveAttribute ( R . attr . apptentiveFontFamilyMediumDefault , tv , true ) ) { if ( newMap == null ) { newMap = new HashMap < String , Typeface > ( ) ; } newMap . put ( tv . string . toString ( ) , newTypeface ) ; } if ( newMap != null ) { try { final Field staticField = Typeface . class . getDeclaredField ( "sSystemFontMap" ) ; staticField . setAccessible ( true ) ; staticField . set ( null , newMap ) ; } catch ( NoSuchFieldException e ) { ApptentiveLog . e ( e , "Exception replacing system font" ) ; logException ( e ) ; } catch ( IllegalAccessException e ) { ApptentiveLog . e ( e , "Exception replacing system font" ) ; logException ( e ) ; } } } else { if ( apptentiveTheme . resolveAttribute ( R . attr . apptentiveTypefaceDefault , tv , true ) ) { staticTypefaceFieldName = "DEFAULT" ; if ( tv . data == context . getResources ( ) . getInteger ( R . integer . apptentive_typeface_monospace ) ) { staticTypefaceFieldName = "MONOSPACE" ; } else if ( tv . data == context . getResources ( ) . getInteger ( R . integer . apptentive_typeface_serif ) ) { staticTypefaceFieldName = "SERIF" ; } else if ( tv . data == context . getResources ( ) . getInteger ( R . integer . apptentive_typeface_sans ) ) { staticTypefaceFieldName = "SANS_SERIF" ; } try { final Field staticField = Typeface . class . getDeclaredField ( staticTypefaceFieldName ) ; staticField . setAccessible ( true ) ; staticField . set ( null , newTypeface ) ; } catch ( NoSuchFieldException e ) { ApptentiveLog . e ( e , "Exception replacing system font" ) ; logException ( e ) ; } catch ( IllegalAccessException e ) { ApptentiveLog . e ( e , "Exception replacing system font" ) ; logException ( e ) ; } } }
|
public class Caster { /** * cast a Object to a Component
* @ param o Object to cast
* @ return casted Component
* @ throws PageException */
public static Component toComponent ( Object o ) throws PageException { } }
|
if ( o instanceof Component ) return ( Component ) o ; else if ( o instanceof ObjectWrap ) { return toComponent ( ( ( ObjectWrap ) o ) . getEmbededObject ( ) ) ; } throw new CasterException ( o , "Component" ) ;
|
public class QueryServiceImpl { /** * Fetches the raw text from the text . tab file .
* @ param top the name of the top level corpus .
* @ param docname the name of the document .
* @ return Can be empty , if the corpus only contains media data or
* segmentations . */
@ GET @ Path ( "rawtext/{top}/{docname}" ) @ Produces ( MediaType . APPLICATION_XML ) public RawTextWrapper getRawText ( @ PathParam ( "top" ) String top , @ PathParam ( "docname" ) String docname ) { } }
|
Subject user = SecurityUtils . getSubject ( ) ; user . checkPermission ( "query:raw_text:" + top ) ; RawTextWrapper result = new RawTextWrapper ( ) ; result . setTexts ( queryDao . getRawText ( top , docname ) ) ; return result ;
|
public class X500Name { /** * Return an immutable List of all RDNs in this X500Name . */
public List < RDN > rdns ( ) { } }
|
List < RDN > list = rdnList ; if ( list == null ) { list = Collections . unmodifiableList ( Arrays . asList ( names ) ) ; rdnList = list ; } return list ;
|
public class NativeDate { /** * / * the javascript constructor */
private static Object jsConstructor ( Object [ ] args ) { } }
|
NativeDate obj = new NativeDate ( ) ; // if called as a constructor with no args ,
// return a new Date with the current time .
if ( args . length == 0 ) { obj . date = now ( ) ; return obj ; } // if called with just one arg -
if ( args . length == 1 ) { Object arg0 = args [ 0 ] ; if ( arg0 instanceof NativeDate ) { obj . date = ( ( NativeDate ) arg0 ) . date ; return obj ; } if ( arg0 instanceof Scriptable ) { arg0 = ( ( Scriptable ) arg0 ) . getDefaultValue ( null ) ; } double date ; if ( arg0 instanceof CharSequence ) { // it ' s a string ; parse it .
date = date_parseString ( arg0 . toString ( ) ) ; } else { // if it ' s not a string , use it as a millisecond date
date = ScriptRuntime . toNumber ( arg0 ) ; } obj . date = TimeClip ( date ) ; return obj ; } double time = date_msecFromArgs ( args ) ; if ( ! Double . isNaN ( time ) && ! Double . isInfinite ( time ) ) time = TimeClip ( internalUTC ( time ) ) ; obj . date = time ; return obj ;
|
public class BulkSubmissionPublisher { /** * Submit int .
* @ param dataArray the data array
* @ return the int */
public int submit ( T [ ] dataArray ) { } }
|
return submitBulk ( Optional . ofNullable ( dataArray ) . map ( Arrays :: asList ) . orElseGet ( Collections :: emptyList ) ) ;
|
public class MaterialNavigationDrawer { /** * private methods */
private MaterialAccount findAccountNumber ( int number ) { } }
|
for ( MaterialAccount account : accountManager ) if ( account . getAccountNumber ( ) == number ) return account ; return null ;
|
public class Timex3Interval { /** * setter for beginTimex - sets
* @ generated
* @ param v value to set into the feature */
public void setBeginTimex ( String v ) { } }
|
if ( Timex3Interval_Type . featOkTst && ( ( Timex3Interval_Type ) jcasType ) . casFeat_beginTimex == null ) jcasType . jcas . throwFeatMissing ( "beginTimex" , "de.unihd.dbs.uima.types.heideltime.Timex3Interval" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( Timex3Interval_Type ) jcasType ) . casFeatCode_beginTimex , v ) ;
|
public class TasksInner { /** * Returns a task with extended information that includes all secrets .
* @ param resourceGroupName The name of the resource group to which the container registry belongs .
* @ param registryName The name of the container registry .
* @ param taskName The name of the container registry task .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws CloudException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the TaskInner object if successful . */
public TaskInner getDetails ( String resourceGroupName , String registryName , String taskName ) { } }
|
return getDetailsWithServiceResponseAsync ( resourceGroupName , registryName , taskName ) . toBlocking ( ) . single ( ) . body ( ) ;
|
public class CmsWorkplace { /** * Returns all initialized parameters of the current workplace class
* that are not in the given exclusion list as hidden field tags that can be inserted in a form . < p >
* @ param excludes the parameters to exclude
* @ return all initialized parameters of the current workplace class
* that are not in the given exclusion list as hidden field tags that can be inserted in a form */
public String paramsAsHidden ( Collection < String > excludes ) { } }
|
StringBuffer result = new StringBuffer ( 512 ) ; Map < String , Object > params = paramValues ( ) ; Iterator < Entry < String , Object > > i = params . entrySet ( ) . iterator ( ) ; while ( i . hasNext ( ) ) { Entry < String , Object > entry = i . next ( ) ; String param = entry . getKey ( ) ; if ( ( excludes == null ) || ( ! excludes . contains ( param ) ) ) { result . append ( "<input type=\"hidden\" name=\"" ) ; result . append ( param ) ; result . append ( "\" value=\"" ) ; String encoded = CmsEncoder . encode ( entry . getValue ( ) . toString ( ) , getCms ( ) . getRequestContext ( ) . getEncoding ( ) ) ; result . append ( encoded ) ; result . append ( "\">\n" ) ; } } return result . toString ( ) ;
|
public class Metric { /** * To return an identifier string , the format is & lt ; namespace & gt ; : & lt ; scope & gt ; : & lt ; name & gt ; { & lt ; tags & gt ; }
* @ return Returns a metric identifier for the metric . Will never return null . */
@ JsonIgnore public String getIdentifier ( ) { } }
|
String tags = "" ; Map < String , String > sortedTags = new TreeMap < > ( ) ; sortedTags . putAll ( getTags ( ) ) ; if ( ! sortedTags . isEmpty ( ) ) { StringBuilder tagListBuffer = new StringBuilder ( "{" ) ; for ( String tagKey : sortedTags . keySet ( ) ) { tagListBuffer . append ( tagKey ) . append ( '=' ) . append ( sortedTags . get ( tagKey ) ) . append ( ',' ) ; } tags = tagListBuffer . substring ( 0 , tagListBuffer . length ( ) - 1 ) . concat ( "}" ) ; } String namespace = getNamespace ( ) ; Object [ ] params = { namespace == null ? "" : namespace + ":" , getScope ( ) , getMetric ( ) , tags } ; String format = "{0}{1}:{2}" + "{3}" ; return MessageFormat . format ( format , params ) ;
|
public class DateTimePerformance { private void checkJodaSetGetHour ( ) { } }
|
int COUNT = COUNT_VERY_FAST ; // Is it fair to use only MutableDateTime here ? You decide .
MutableDateTime dt = new MutableDateTime ( GJChronology . getInstance ( ) ) ; for ( int i = 0 ; i < AVERAGE ; i ++ ) { start ( "Joda" , "setGetHour" ) ; for ( int j = 0 ; j < COUNT ; j ++ ) { dt . setHourOfDay ( 13 ) ; int val = dt . getHourOfDay ( ) ; if ( dt == null ) { System . out . println ( "Anti optimise" ) ; } } end ( COUNT ) ; }
|
public class DynamicClassGenerator { /** * Shortcut for { @ link # generate ( Class , Class , Class ) } method to create classes with provided scope
* ( and without extra anchor ) .
* Method is thread safe .
* @ param type interface or abstract class
* @ param scope scope annotation to apply on generated class ( may be null for default prototype scope )
* @ param < T > type
* @ return implementation class for provided type ( will not generate if class already exist ) */
public static < T > Class < T > generate ( final Class < T > type , final Class < ? extends java . lang . annotation . Annotation > scope ) { } }
|
return generate ( type , scope , null ) ;
|
public class AbstractDocumentQuery { /** * Gets the fields for projection
* @ return list of projected fields */
@ Override public List < String > getProjectionFields ( ) { } }
|
return fieldsToFetchToken != null && fieldsToFetchToken . projections != null ? Arrays . asList ( fieldsToFetchToken . projections ) : Collections . emptyList ( ) ;
|
public class DOMProcessing { /** * Creates a DOM { @ link Element } for a { @ link QualifiedName } and content given by value
* @ param elementName a { @ link QualifiedName } to denote the element name
* @ param value for the created { @ link Element }
* @ return a new { @ link Element } */
final static public Element newElement ( QualifiedName elementName , QualifiedName value ) { } }
|
org . w3c . dom . Document doc = builder . newDocument ( ) ; Element el = doc . createElementNS ( elementName . getNamespaceURI ( ) , qualifiedNameToString ( elementName . toQName ( ) ) ) ; // 1 . we add an xsi : type = " xsd : QName " attribute
// making sure xsi and xsd prefixes are appropriately declared .
el . setAttributeNS ( NamespacePrefixMapper . XSI_NS , "xsi:type" , "xsd:QName" ) ; el . setAttributeNS ( "http://www.w3.org/2000/xmlns/" , "xmlns:xsd" , XSD_NS_FOR_XML ) ; // 2 . We add the QualifiedName ' s string representation as child of the element
// This representation depends on the extant prefix - namespace mapping
String valueAsString = qualifiedNameToString ( value . toQName ( ) ) ; el . appendChild ( doc . createTextNode ( valueAsString ) ) ; // 3 . We make sure that the QualifiedName ' s prefix is given the right namespace , or the default namespace is declared if there is no prefix
int index = valueAsString . indexOf ( ":" ) ; if ( index != - 1 ) { String prefix = valueAsString . substring ( 0 , index ) ; el . setAttributeNS ( "http://www.w3.org/2000/xmlns/" , "xmlns:" + prefix , convertNsToXml ( value . getNamespaceURI ( ) ) ) ; } else { el . setAttributeNS ( "http://www.w3.org/2000/xmlns/" , "xmlns" , convertNsToXml ( value . getNamespaceURI ( ) ) ) ; } doc . appendChild ( el ) ; return el ;
|
public class ListUtil { /** * cast a Object Array to a String Array
* @ param array
* @ return String Array */
public static String [ ] toStringArrayEL ( Array array ) { } }
|
String [ ] arr = new String [ array . size ( ) ] ; for ( int i = 0 ; i < arr . length ; i ++ ) { arr [ i ] = Caster . toString ( array . get ( i + 1 , null ) , null ) ; } return arr ;
|
public class AnnivMaster { /** * Add this field in the Record ' s field sequence . */
public BaseField setupField ( int iFieldSeq ) { } }
|
BaseField field = null ; // if ( iFieldSeq = = 0)
// field = new CounterField ( this , ID , Constants . DEFAULT _ FIELD _ LENGTH , null , null ) ;
// field . setHidden ( true ) ;
// if ( iFieldSeq = = 1)
// field = new RecordChangedField ( this , LAST _ CHANGED , Constants . DEFAULT _ FIELD _ LENGTH , null , null ) ;
// field . setHidden ( true ) ;
// if ( iFieldSeq = = 2)
// field = new BooleanField ( this , DELETED , Constants . DEFAULT _ FIELD _ LENGTH , null , new Boolean ( false ) ) ;
// field . setHidden ( true ) ;
if ( iFieldSeq == 3 ) field = new DateTimeField ( this , START_DATE_TIME , Constants . DEFAULT_FIELD_LENGTH , null , null ) ; if ( iFieldSeq == 4 ) field = new DateTimeField ( this , END_DATE_TIME , Constants . DEFAULT_FIELD_LENGTH , null , null ) ; if ( iFieldSeq == 5 ) field = new StringField ( this , DESCRIPTION , 60 , null , null ) ; if ( iFieldSeq == 6 ) field = new RepeatIntervalField ( this , REPEAT_INTERVAL_ID , Constants . DEFAULT_FIELD_LENGTH , null , null ) ; if ( iFieldSeq == 7 ) field = new ShortField ( this , REPEAT_COUNT , Constants . DEFAULT_FIELD_LENGTH , null , null ) ; if ( iFieldSeq == 8 ) field = new CalendarCategoryField ( this , CALENDAR_CATEGORY_ID , Constants . DEFAULT_FIELD_LENGTH , null , null ) ; if ( iFieldSeq == 9 ) field = new BooleanField ( this , HIDDEN , Constants . DEFAULT_FIELD_LENGTH , null , new Boolean ( false ) ) ; if ( iFieldSeq == 10 ) field = new PropertiesField ( this , PROPERTIES , Constants . DEFAULT_FIELD_LENGTH , null , null ) ; if ( field == null ) field = super . setupField ( iFieldSeq ) ; return field ;
|
public class TrieData { /** * one entry per line . word first , then tab , then data */
public void toIdFile ( OutputStream os ) throws IOException { } }
|
BufferedWriter writer = new BufferedWriter ( new OutputStreamWriter ( os ) ) ; for ( TrieNodeData < T > child : root . children . values ( ) ) { child . writeIds ( writer , new char [ 0 ] ) ; // recursive
} writer . close ( ) ;
|
import java . util . * ; class Main { /** * This function transforms the provided array into a set .
* Examples :
* convertArrayIntoSet ( new String [ ] { " x " , " y " , " z " } ) - > { " x " , " y " , " z " }
* convertArrayIntoSet ( new String [ ] { " a " , " b " , " c " } ) - > { " a " , " b " , " c " }
* convertArrayIntoSet ( new String [ ] { " z " , " d " , " e " } ) - > { " z " , " d " , " e " }
* @ param inputArray an array of strings
* @ return Returns a set constructed from the elements of the input array . */
public static Set < String > convertArrayIntoSet ( String [ ] inputArray ) { } }
|
Set < String > outputSet = new HashSet < String > ( Arrays . asList ( inputArray ) ) ; return outputSet ;
|
public class CustomerConfirmation { /** * region > downloadCustomerConfirmation ( action ) */
@ Action ( semantics = SemanticsOf . SAFE ) @ ActionLayout ( contributed = Contributed . AS_ACTION ) @ MemberOrder ( sequence = "10" ) public Blob downloadCustomerConfirmation ( final Order order ) throws IOException , JDOMException , MergeException { } }
|
final org . w3c . dom . Document w3cDocument = asInputW3cDocument ( order ) ; final ByteArrayOutputStream docxTarget = new ByteArrayOutputStream ( ) ; docxService . merge ( w3cDocument , wordprocessingMLPackage , docxTarget , DocxService . MatchingPolicy . LAX ) ; final String blobName = "customerConfirmation-" + order . getNumber ( ) + ".docx" ; final String blobMimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document" ; final byte [ ] blobBytes = docxTarget . toByteArray ( ) ; return new Blob ( blobName , blobMimeType , blobBytes ) ;
|
public class EscapeTransliterator { /** * Registers standard variants with the system . Called by
* Transliterator during initialization . */
static void register ( ) { } }
|
// Unicode : " U + 10FFFF " hex , min = 4 , max = 6
Transliterator . registerFactory ( "Any-Hex/Unicode" , new Transliterator . Factory ( ) { @ Override public Transliterator getInstance ( String ID ) { return new EscapeTransliterator ( "Any-Hex/Unicode" , "U+" , "" , 16 , 4 , true , null ) ; } } ) ; // Java : " \ \ uFFFF " hex , min = 4 , max = 4
Transliterator . registerFactory ( "Any-Hex/Java" , new Transliterator . Factory ( ) { @ Override public Transliterator getInstance ( String ID ) { return new EscapeTransliterator ( "Any-Hex/Java" , "\\u" , "" , 16 , 4 , false , null ) ; } } ) ; // C : " \ \ uFFFF " hex , min = 4 , max = 4 ; \ \ U0010FFFF hex , min = 8 , max = 8
Transliterator . registerFactory ( "Any-Hex/C" , new Transliterator . Factory ( ) { @ Override public Transliterator getInstance ( String ID ) { return new EscapeTransliterator ( "Any-Hex/C" , "\\u" , "" , 16 , 4 , true , new EscapeTransliterator ( "" , "\\U" , "" , 16 , 8 , true , null ) ) ; } } ) ; // XML : " & # x10FFFF ; " hex , min = 1 , max = 6
Transliterator . registerFactory ( "Any-Hex/XML" , new Transliterator . Factory ( ) { @ Override public Transliterator getInstance ( String ID ) { return new EscapeTransliterator ( "Any-Hex/XML" , "&#x" , ";" , 16 , 1 , true , null ) ; } } ) ; // XML10 : " & 1114111 ; " dec , min = 1 , max = 7 ( not really " Any - Hex " )
Transliterator . registerFactory ( "Any-Hex/XML10" , new Transliterator . Factory ( ) { @ Override public Transliterator getInstance ( String ID ) { return new EscapeTransliterator ( "Any-Hex/XML10" , "&#" , ";" , 10 , 1 , true , null ) ; } } ) ; // Perl : " \ \ x { 263A } " hex , min = 1 , max = 6
Transliterator . registerFactory ( "Any-Hex/Perl" , new Transliterator . Factory ( ) { @ Override public Transliterator getInstance ( String ID ) { return new EscapeTransliterator ( "Any-Hex/Perl" , "\\x{" , "}" , 16 , 1 , true , null ) ; } } ) ; // Plain : " FFFF " hex , min = 4 , max = 6
Transliterator . registerFactory ( "Any-Hex/Plain" , new Transliterator . Factory ( ) { @ Override public Transliterator getInstance ( String ID ) { return new EscapeTransliterator ( "Any-Hex/Plain" , "" , "" , 16 , 4 , true , null ) ; } } ) ; // Generic
Transliterator . registerFactory ( "Any-Hex" , new Transliterator . Factory ( ) { @ Override public Transliterator getInstance ( String ID ) { return new EscapeTransliterator ( "Any-Hex" , "\\u" , "" , 16 , 4 , false , null ) ; } } ) ;
|
public class GPARCImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public Object eGet ( int featureID , boolean resolve , boolean coreType ) { } }
|
switch ( featureID ) { case AfplibPackage . GPARC__XPOS : return getXPOS ( ) ; case AfplibPackage . GPARC__YPOS : return getYPOS ( ) ; case AfplibPackage . GPARC__XCENT : return getXCENT ( ) ; case AfplibPackage . GPARC__YCENT : return getYCENT ( ) ; case AfplibPackage . GPARC__MH : return getMH ( ) ; case AfplibPackage . GPARC__MFR : return getMFR ( ) ; case AfplibPackage . GPARC__START : return getSTART ( ) ; case AfplibPackage . GPARC__SWEEP : return getSWEEP ( ) ; } return super . eGet ( featureID , resolve , coreType ) ;
|
public class DisconfCenterStore { /** * 存储 一个配置文件 */
public void storeOneFile ( DisconfCenterBaseModel disconfCenterBaseModel ) { } }
|
DisconfCenterFile disconfCenterFile = ( DisconfCenterFile ) disconfCenterBaseModel ; String fileName = disconfCenterFile . getFileName ( ) ; if ( confFileMap . containsKey ( fileName ) ) { LOGGER . warn ( "There are two same fileName key!!!! " + fileName ) ; DisconfCenterFile existCenterFile = confFileMap . get ( fileName ) ; // 如果是 同时使用了 注解式 和 非注解式 两种方式 , 则当修改时也要 进行 XML 式 reload
if ( disconfCenterFile . isTaggedWithNonAnnotationFile ( ) ) { existCenterFile . setIsTaggedWithNonAnnotationFile ( true ) ; } } else { confFileMap . put ( fileName , disconfCenterFile ) ; }
|
public class YamlReader { /** * Returns a new object of the requested type . */
protected Object createObject ( Class type ) throws InvocationTargetException { } }
|
// Use deferred construction if a non - zero - arg constructor is available .
DeferredConstruction deferredConstruction = Beans . getDeferredConstruction ( type , config ) ; if ( deferredConstruction != null ) return deferredConstruction ; return Beans . createObject ( type , config . privateConstructors ) ;
|
public class ClassloaderManager { /** * Returns all the URL that should be inside the classpath . This includes the jar itself if any .
* @ throws JqmPayloadException */
private URL [ ] getClasspath ( JobInstance ji , JobRunnerCallback cb ) throws JqmPayloadException { } }
|
switch ( ji . getJD ( ) . getPathType ( ) ) { case MAVEN : return mavenResolver . resolve ( ji ) ; case MEMORY : return new URL [ 0 ] ; case FS : default : return fsResolver . getLibraries ( ji . getNode ( ) , ji . getJD ( ) ) ; }
|
public class FastThreadLocal { /** * Sets the value to uninitialized for the specified thread local map ;
* a proceeding call to get ( ) will trigger a call to initialValue ( ) .
* The specified thread local map must be for the current thread . */
@ SuppressWarnings ( "unchecked" ) public final void remove ( InternalThreadLocalMap threadLocalMap ) { } }
|
if ( threadLocalMap == null ) { return ; } Object v = threadLocalMap . removeIndexedVariable ( index ) ; removeFromVariablesToRemove ( threadLocalMap , this ) ; if ( v != InternalThreadLocalMap . UNSET ) { try { onRemoval ( ( V ) v ) ; } catch ( Exception e ) { PlatformDependent . throwException ( e ) ; } }
|
public class InitializeClusterRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( InitializeClusterRequest initializeClusterRequest , ProtocolMarshaller protocolMarshaller ) { } }
|
if ( initializeClusterRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( initializeClusterRequest . getClusterId ( ) , CLUSTERID_BINDING ) ; protocolMarshaller . marshall ( initializeClusterRequest . getSignedCert ( ) , SIGNEDCERT_BINDING ) ; protocolMarshaller . marshall ( initializeClusterRequest . getTrustAnchor ( ) , TRUSTANCHOR_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
|
public class CamelRouteAdapter { /** * Returns the latest version whose attributes match the custom attribute
* criteria specified via " CustomAttributes " .
* Override to apply additional or non - standard conditions .
* @ param version */
protected RoutesDefinition getRoutesDefinition ( String name , String version ) throws AdapterException { } }
|
String modifier = "" ; Map < String , String > params = getHandlerParameters ( ) ; if ( params != null ) { for ( String paramName : params . keySet ( ) ) { if ( modifier . length ( ) == 0 ) modifier += "?" ; else modifier += "&" ; modifier += paramName + "=" + params . get ( paramName ) ; } } Map < String , String > customAttrs = null ; String customAttrString = getAttributeValue ( CUSTOM_ATTRIBUTES ) ; if ( ! StringHelper . isEmpty ( customAttrString ) ) { customAttrs = StringHelper . parseMap ( customAttrString ) ; } RoutesDefinitionRuleSet rdrs ; if ( version == null ) rdrs = CamelRouteCache . getRoutesDefinitionRuleSet ( name , modifier , customAttrs ) ; else rdrs = CamelRouteCache . getRoutesDefinitionRuleSet ( new AssetVersionSpec ( name , version ) , modifier , customAttrs ) ; if ( rdrs == null ) { throw new AdapterException ( "Unable to load Camel route: " + name + modifier ) ; } else { super . logdebug ( "Using RoutesDefinition: " + rdrs . getRuleSet ( ) . getLabel ( ) ) ; return rdrs . getRoutesDefinition ( ) ; }
|
public class PoolUtil { /** * Returns sql statement used in this prepared statement together with the parameters .
* @ param sql base sql statement
* @ param logParams parameters to print out
* @ return returns printable statement */
public static String fillLogParams ( String sql , Map < Object , Object > logParams ) { } }
|
StringBuilder result = new StringBuilder ( ) ; Map < Object , Object > tmpLogParam = ( logParams == null ? new HashMap < Object , Object > ( ) : logParams ) ; Iterator < Object > it = tmpLogParam . values ( ) . iterator ( ) ; boolean inQuote = false ; boolean inQuote2 = false ; char [ ] sqlChar = sql != null ? sql . toCharArray ( ) : new char [ ] { } ; for ( int i = 0 ; i < sqlChar . length ; i ++ ) { if ( sqlChar [ i ] == '\'' ) { inQuote = ! inQuote ; } if ( sqlChar [ i ] == '"' ) { inQuote2 = ! inQuote2 ; } if ( sqlChar [ i ] == '?' && ! ( inQuote || inQuote2 ) ) { if ( it . hasNext ( ) ) { result . append ( prettyPrint ( it . next ( ) ) ) ; } else { result . append ( '?' ) ; } } else { result . append ( sqlChar [ i ] ) ; } } return result . toString ( ) ;
|
public class SnappyLoader { /** * Extract the specified library file to the target folder
* @ param libFolderForCurrentOS
* @ param libraryFileName
* @ param targetFolder
* @ return */
private static File extractLibraryFile ( String libFolderForCurrentOS , String libraryFileName , String targetFolder ) { } }
|
String nativeLibraryFilePath = libFolderForCurrentOS + "/" + libraryFileName ; // Attach UUID to the native library file to ensure multiple class loaders can read the libsnappy - java multiple times .
String uuid = UUID . randomUUID ( ) . toString ( ) ; String extractedLibFileName = String . format ( "snappy-%s-%s-%s" , getVersion ( ) , uuid , libraryFileName ) ; File extractedLibFile = new File ( targetFolder , extractedLibFileName ) ; try { // Extract a native library file into the target directory
InputStream reader = null ; FileOutputStream writer = null ; try { reader = SnappyLoader . class . getResourceAsStream ( nativeLibraryFilePath ) ; try { writer = new FileOutputStream ( extractedLibFile ) ; byte [ ] buffer = new byte [ 8192 ] ; int bytesRead = 0 ; while ( ( bytesRead = reader . read ( buffer ) ) != - 1 ) { writer . write ( buffer , 0 , bytesRead ) ; } } finally { if ( writer != null ) { writer . close ( ) ; } } } finally { if ( reader != null ) { reader . close ( ) ; } // Delete the extracted lib file on JVM exit .
extractedLibFile . deleteOnExit ( ) ; } // Set executable ( x ) flag to enable Java to load the native library
boolean success = extractedLibFile . setReadable ( true ) && extractedLibFile . setWritable ( true , true ) && extractedLibFile . setExecutable ( true ) ; if ( ! success ) { // Setting file flag may fail , but in this case another error will be thrown in later phase
} // Check whether the contents are properly copied from the resource folder
{ InputStream nativeIn = null ; InputStream extractedLibIn = null ; try { nativeIn = SnappyLoader . class . getResourceAsStream ( nativeLibraryFilePath ) ; extractedLibIn = new FileInputStream ( extractedLibFile ) ; if ( ! contentsEquals ( nativeIn , extractedLibIn ) ) { throw new SnappyError ( SnappyErrorCode . FAILED_TO_LOAD_NATIVE_LIBRARY , String . format ( "Failed to write a native library file at %s" , extractedLibFile ) ) ; } } finally { if ( nativeIn != null ) { nativeIn . close ( ) ; } if ( extractedLibIn != null ) { extractedLibIn . close ( ) ; } } } return new File ( targetFolder , extractedLibFileName ) ; } catch ( IOException e ) { e . printStackTrace ( System . err ) ; return null ; }
|
public class MavenProjectScannerPlugin { /** * Resolves a maven project .
* @ param project
* The project
* @ param expectedType
* The expected descriptor type .
* @ param scannerContext
* The scanner context .
* @ param < T >
* The expected descriptor type .
* @ return The maven project descriptor . */
protected < T extends MavenProjectDescriptor > T resolveProject ( MavenProject project , Class < T > expectedType , ScannerContext scannerContext ) { } }
|
Store store = scannerContext . getStore ( ) ; String id = project . getGroupId ( ) + ":" + project . getArtifactId ( ) + ":" + project . getVersion ( ) ; MavenProjectDescriptor projectDescriptor = store . find ( MavenProjectDescriptor . class , id ) ; if ( projectDescriptor == null ) { projectDescriptor = store . create ( expectedType , id ) ; projectDescriptor . setName ( project . getName ( ) ) ; projectDescriptor . setGroupId ( project . getGroupId ( ) ) ; projectDescriptor . setArtifactId ( project . getArtifactId ( ) ) ; projectDescriptor . setVersion ( project . getVersion ( ) ) ; projectDescriptor . setPackaging ( project . getPackaging ( ) ) ; projectDescriptor . setFullQualifiedName ( id ) ; } else if ( ! expectedType . isAssignableFrom ( projectDescriptor . getClass ( ) ) ) { projectDescriptor = store . addDescriptorType ( projectDescriptor , expectedType ) ; } return expectedType . cast ( projectDescriptor ) ;
|
public class DenseVectorSupportMethods { /** * WARNING : only returns the right answer for vectors of length < MAX _ SMALL _ DOT _ PRODUCT _ LENGTH
* @ param a
* @ param b
* @ param length
* @ return */
public static double smallDotProduct_Double ( double [ ] a , double [ ] b , int length ) { } }
|
double sumA = 0.0 ; double sumB = 0.0 ; switch ( length ) { case 7 : sumA = a [ 6 ] * b [ 6 ] ; case 6 : sumB = a [ 5 ] * b [ 5 ] ; case 5 : sumA += a [ 4 ] * b [ 4 ] ; case 4 : sumB += a [ 3 ] * b [ 3 ] ; case 3 : sumA += a [ 2 ] * b [ 2 ] ; case 2 : sumB += a [ 1 ] * b [ 1 ] ; case 1 : sumA += a [ 0 ] * b [ 0 ] ; case 0 : default : return sumA + sumB ; }
|
public class Workbook { /** * Returns the current offset for the given date allowing for daylight savings .
* @ param dt The date to be checked
* @ return The current offset for the given date allowing for daylight savings */
protected int getOffset ( long dt ) { } }
|
int ret = 0 ; TimeZone tz = DateUtilities . getCurrentTimeZone ( ) ; if ( tz != null ) ret = tz . getOffset ( dt ) ; return ret ;
|
public class IndexExpression { /** * Deserializes an < code > IndexExpression < / code > instance from the specified input .
* @ param input the input to read from
* @ return the < code > IndexExpression < / code > instance deserialized
* @ throws IOException if a problem occurs while deserializing the < code > IndexExpression < / code > instance . */
public static IndexExpression readFrom ( DataInput input ) throws IOException { } }
|
return new IndexExpression ( ByteBufferUtil . readWithShortLength ( input ) , Operator . readFrom ( input ) , ByteBufferUtil . readWithShortLength ( input ) ) ;
|
public class ProcessUtil { /** * Runs the given set of command line arguments as a system process and returns the exit value of the spawned
* process . Outputs of the process ( both normal and error ) are passed to the { @ code consumer } .
* @ param commandLine
* the list of command line arguments to run
* @ param consumer
* the consumer for the program ' s output
* @ return the exit code of the process
* @ throws IOException
* if an exception occurred while reading the process ' outputs
* @ throws InterruptedException
* if an exception occurred during process exception */
public static int invokeProcess ( String [ ] commandLine , Consumer < String > consumer ) throws IOException , InterruptedException { } }
|
return invokeProcess ( commandLine , null , new DelegatingConsumer ( consumer ) ) ;
|
public class LegacyJavaRuntime { /** * Gets { @ link Throwable # getStackTraceElement ( int ) } as accessible method .
* @ return Instance if available , { @ code null } if not */
private static Method getStackTraceElementGetter ( ) { } }
|
try { Method method = Throwable . class . getDeclaredMethod ( "getStackTraceElement" , int . class ) ; method . setAccessible ( true ) ; StackTraceElement stackTraceElement = ( StackTraceElement ) method . invoke ( new Throwable ( ) , 0 ) ; if ( LegacyJavaRuntime . class . getName ( ) . equals ( stackTraceElement . getClassName ( ) ) ) { return method ; } else { return null ; } } catch ( Exception ex ) { return null ; }
|
public class UTF8String { /** * TODO : Need to use ` Code Point ` here instead of Char in case the character longer than 2 bytes */
public UTF8String translate ( Map < Character , Character > dict ) { } }
|
String srcStr = this . toString ( ) ; StringBuilder sb = new StringBuilder ( ) ; for ( int k = 0 ; k < srcStr . length ( ) ; k ++ ) { if ( null == dict . get ( srcStr . charAt ( k ) ) ) { sb . append ( srcStr . charAt ( k ) ) ; } else if ( '\0' != dict . get ( srcStr . charAt ( k ) ) ) { sb . append ( dict . get ( srcStr . charAt ( k ) ) ) ; } } return fromString ( sb . toString ( ) ) ;
|
public class MarketEquilibrium { /** * Calculates the portfolio variance using the input instrument weights . */
public Scalar < ? > calculatePortfolioVariance ( final PrimitiveMatrix assetWeights ) { } }
|
PrimitiveMatrix tmpLeft ; PrimitiveMatrix tmpRight ; if ( assetWeights . countColumns ( ) == 1L ) { tmpLeft = assetWeights . transpose ( ) ; tmpRight = assetWeights ; } else { tmpLeft = assetWeights ; tmpRight = assetWeights . transpose ( ) ; } return tmpLeft . multiply ( myCovariances . multiply ( tmpRight ) ) . toScalar ( 0 , 0 ) ;
|
public class ProcessTweaks { /** * Passes the compiler default value overrides to the JS by replacing calls
* to goog . tweak . getCompilerOverrids _ with a map of tweak ID - > default value ; */
private void replaceGetCompilerOverridesCalls ( List < TweakFunctionCall > calls ) { } }
|
for ( TweakFunctionCall call : calls ) { Node callNode = call . callNode ; Node objNode = createCompilerDefaultValueOverridesVarNode ( callNode ) ; callNode . replaceWith ( objNode ) ; compiler . reportChangeToEnclosingScope ( objNode ) ; }
|
public class SConverterGeneratorWrapper { public void generate ( Set < EPackage > ePackages ) { } }
|
try { FileUtils . forceMkdir ( packageFolder ) ; } catch ( IOException e ) { LOGGER . error ( "" , e ) ; } SConverterGenerator converterGenerator = new SConverterGenerator ( ) ; Object [ ] arguments = new Object [ ] { metaDataManager , ePackages } ; String generated = converterGenerator . generate ( arguments ) ; File file = new File ( packageFolder , "SConverter.java" ) ; try { OutputStream fileOutputStream = new FileOutputStream ( file ) ; fileOutputStream . write ( generated . getBytes ( Charsets . UTF_8 ) ) ; fileOutputStream . close ( ) ; } catch ( FileNotFoundException e ) { LOGGER . error ( "" , e ) ; } catch ( UnsupportedEncodingException e ) { LOGGER . error ( "" , e ) ; } catch ( IOException e ) { LOGGER . error ( "" , e ) ; }
|
public class RaftAgent { /** * Create an instance of { @ code RaftAgent } from a configuration file .
* @ param configFile location of the JSON configuration file . The
* configuration in this file will be validated .
* See the project README . md for more on the configuration file
* @ param raftListener instance of { @ code RaftListener } that will be notified of events from the Raft cluster
* @ return valid { @ code RaftAgent } that can be used to connect to , and ( if leader ) ,
* replicate { @ link Command } instances to the Raft cluster
* @ throws IOException if the configuration file cannot be loaded or processed ( i . e . contains invalid JSON ) */
public static RaftAgent fromConfigurationFile ( String configFile , RaftListener raftListener ) throws IOException { } }
|
RaftConfiguration configuration = RaftConfigurationLoader . loadFromFile ( configFile ) ; return fromConfigurationObject ( configuration , raftListener ) ;
|
public class GeneralFft_to_DiscreteFourierTransform_F32 { /** * Declare the algorithm if the image size has changed */
private void checkDeclareAlg ( GrayF32 image ) { } }
|
if ( prevWidth != image . width || prevHeight != image . height ) { prevWidth = image . width ; prevHeight = image . height ; alg = new GeneralPurposeFFT_F32_2D ( image . height , image . width ) ; }
|
public class ExcelTemplateWriter { /** * write . */
public void write ( ) { } }
|
try { org . jxls . common . Context ctx = new org . jxls . common . Context ( ) ; for ( Map . Entry < String , Object > entry : context . getDatas ( ) . entrySet ( ) ) { ctx . putVar ( entry . getKey ( ) , entry . getValue ( ) ) ; } JxlsHelper . getInstance ( ) . processTemplate ( template . openStream ( ) , outputStream , ctx ) ; } catch ( Exception e ) { throw new RuntimeException ( e . getMessage ( ) ) ; }
|
public class EmulatedFields { /** * Finds and returns the short value of a given field named { @ code name } in
* the receiver . If the field has not been assigned any value yet , the
* default value { @ code defaultValue } is returned instead .
* @ param name
* the name of the field to find .
* @ param defaultValue
* return value in case the field has not been assigned to yet .
* @ return the value of the given field if it has been assigned , the default
* value otherwise .
* @ throws IllegalArgumentException
* if the corresponding field can not be found . */
public short get ( String name , short defaultValue ) throws IllegalArgumentException { } }
|
ObjectSlot slot = findMandatorySlot ( name , short . class ) ; return slot . defaulted ? defaultValue : ( ( Short ) slot . fieldValue ) . shortValue ( ) ;
|
public class SoapAttachment { /** * Get the content file resource path .
* @ return the content resource path */
public String getContentResourcePath ( ) { } }
|
if ( contentResourcePath != null && context != null ) { return context . replaceDynamicContentInString ( contentResourcePath ) ; } else { return contentResourcePath ; }
|
public class ContentSecurityPolicyFilter { /** * Returns the value of the initParam .
* @ param filterConfig a FilterConfig instance
* @ param initParam the name of the init parameter
* @ param variable the variable to use if the init param was not defined
* @ return a String */
private String getValue ( FilterConfig filterConfig , String initParam , String variable ) { } }
|
final String value = filterConfig . getInitParameter ( initParam ) ; if ( StringUtils . isNotBlank ( value ) ) { return value ; } else { return variable ; }
|
public class SentimentAlchemyEntity { /** * Set sentiment polarity : " positive " , " negative " , or " neutral " .
* @ param type sentiment polarity
* @ see # setType ( SentimentAlchemyEntity . TYPE ) */
public void setType ( String type ) { } }
|
if ( StringUtils . isBlank ( type ) ) { setType ( TYPE . UNSET ) ; } else { if ( TYPE . NEGATIVE . toString ( ) . equalsIgnoreCase ( type . trim ( ) ) ) { setType ( TYPE . NEGATIVE ) ; } if ( TYPE . NEUTRAL . toString ( ) . equalsIgnoreCase ( type . trim ( ) ) ) { setType ( TYPE . NEUTRAL ) ; } if ( TYPE . POSITIVE . toString ( ) . equalsIgnoreCase ( type . trim ( ) ) ) { setType ( TYPE . POSITIVE ) ; } if ( TYPE . UNSET . toString ( ) . equalsIgnoreCase ( type . trim ( ) ) ) { setType ( TYPE . UNSET ) ; } }
|
public class DefaultOptionParser { /** * Tells if the token looks like a short option .
* @ param token the command line token to handle
* @ return true if the token like a short option */
private boolean isShortOption ( String token ) { } }
|
// short options ( - S , - SV , - S = V , - SV1 = V2 , - S1S2)
if ( ! token . startsWith ( "-" ) || token . length ( ) == 1 ) { return false ; } // remove leading " - " and " = value "
int pos = token . indexOf ( "=" ) ; String name = ( pos == - 1 ? token . substring ( 1 ) : token . substring ( 1 , pos ) ) ; if ( options . hasShortOption ( name ) ) { return true ; } // check for several concatenated short options
return ( name . length ( ) > 0 && options . hasShortOption ( String . valueOf ( name . charAt ( 0 ) ) ) ) ;
|
public class Item { /** * Sets this item to an integer item .
* @ param intVal
* the value of this item . */
void set ( final int intVal ) { } }
|
this . type = ClassWriter . INT ; this . intVal = intVal ; this . hashCode = 0x7FFFFFFF & ( type + intVal ) ;
|
public class ChatDirector { /** * Display the specified system message as if it had come from the server . */
protected void displaySystem ( String bundle , String message , byte attLevel , String localtype ) { } }
|
// nothing should be untranslated , so pass the default bundle if need be .
if ( bundle == null ) { bundle = _bundle ; } SystemMessage msg = new SystemMessage ( message , bundle , attLevel ) ; dispatchMessage ( msg , localtype ) ;
|
public class JsonService { /** * Get a double value from a { @ link JSONObject } .
* @ param jsonObject The object to get the key value from .
* @ param key The name of the key to search the value for .
* @ return Returns the value for the key in the object .
* @ throws JSONException Thrown in case the key could not be found in the JSON object . */
public static Double getDoubleValue ( JSONObject jsonObject , String key ) throws JSONException { } }
|
checkArguments ( jsonObject , key ) ; JSONValue value = jsonObject . get ( key ) ; if ( value != null && value . isNumber ( ) != null ) { double number = ( ( JSONNumber ) value ) . doubleValue ( ) ; return number ; } return null ;
|
public class ZooKeeperClient { /** * Reads data from a node as a JSON object .
* @ param path
* @ return
* @ since 0.3.1
* @ throws ZooKeeperException */
public Object getDataJson ( String path ) throws ZooKeeperException { } }
|
try { Object data = getFromCache ( cacheNameJson , path ) ; if ( data == null ) { data = _readJson ( path ) ; putToCache ( cacheNameJson , path , data ) ; } return data ; } catch ( ZooKeeperException . NodeNotFoundException e ) { return null ; } catch ( Exception e ) { if ( e instanceof ZooKeeperException ) { throw ( ZooKeeperException ) e ; } else { throw new ZooKeeperException ( e ) ; } }
|
public class Href { /** * Create an encoded href for an attribute meta */
public static String concatMetaAttributeHref ( String baseUri , String entityParentName , String attributeName ) { } }
|
return String . format ( "%s/%s/meta/%s" , baseUri , encodePathSegment ( entityParentName ) , encodePathSegment ( attributeName ) ) ;
|
public class CommerceAccountOrganizationRelPersistenceImpl { /** * Returns all the commerce account organization rels where organizationId = & # 63 ; .
* @ param organizationId the organization ID
* @ return the matching commerce account organization rels */
@ Override public List < CommerceAccountOrganizationRel > findByOrganizationId ( long organizationId ) { } }
|
return findByOrganizationId ( organizationId , QueryUtil . ALL_POS , QueryUtil . ALL_POS , null ) ;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.