signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class JqmClientFactory { /** * Return a new client that may be cached or not . Given properties are always use when not cached , and only used at creation time for
* cached clients .
* @ param name
* if null , default client . Otherwise , helpful to retrieve cached clients later .
* @ param p
* a set of properties . Implementation specific . Unknown properties are silently ignored .
* @ param cached
* if false , the client will not be cached and subsequent calls with the same name will return different objects . */
public static JqmClient getClient ( String name , Properties p , boolean cached ) { } } | Properties p2 = null ; if ( binder == null ) { bind ( ) ; } if ( p == null ) { p2 = props ; } else { p2 = new Properties ( props ) ; p2 . putAll ( p ) ; } return binder . getClientFactory ( ) . getClient ( name , p2 , cached ) ; |
public class JsApiMessageImpl { /** * Helper method used by the main Message Property methods to obtain any
* JMS _ IBM _ MQMD _ Properties explicitly set , in the form of a map .
* The method has package level visibility as it is used by JsJmsMessageImpl
* and JsSdoMessageimpl .
* @ return A JsMsgMap containing the Message Property name - value pairs . */
final JsMsgMap getMQMDSetPropertiesMap ( ) { } } | if ( mqMdSetPropertiesMap == null ) { // There will not usually be any set MQMD properties , so the JMF choice defaults to
// to empty ( and will definitely be empty if the message has arrived from a
// pre - v7 WAS ) . This is different from the other maps which default to empty lists .
if ( getHdr2 ( ) . getChoiceField ( JsHdr2Access . MQMDPROPERTIES ) == JsHdr2Access . IS_MQMDPROPERTIES_MAP ) { List < String > keys = ( List < String > ) getHdr2 ( ) . getField ( JsHdr2Access . MQMDPROPERTIES_MAP_NAME ) ; List < Object > values = ( List < Object > ) getHdr2 ( ) . getField ( JsHdr2Access . MQMDPROPERTIES_MAP_VALUE ) ; mqMdSetPropertiesMap = new JsMsgMap ( keys , values ) ; } else { mqMdSetPropertiesMap = new JsMsgMap ( null , null ) ; } } return mqMdSetPropertiesMap ; |
public class SynchronizeFXTomcatChannel { /** * Informs this { @ link CommandTransferServer } that a client received a command .
* @ param message The message containing the received command .
* @ param sender The connection that received the message . */
void recivedMessage ( final ByteBuffer message , final SynchronizeFXTomcatConnection sender ) { } } | if ( LOG . isTraceEnabled ( ) ) { LOG . trace ( "Received a message in thread: id: " + Thread . currentThread ( ) . getName ( ) + ", name: " + Thread . currentThread ( ) . getName ( ) ) ; } List < Command > commands ; try { commands = serializer . deserialize ( message . array ( ) ) ; } catch ( final SynchronizeFXException e ) { try { sender . getWsOutbound ( ) . close ( 0 , null ) ; } catch ( final IOException e1 ) { callback . onClientConnectionError ( sender , new SynchronizeFXException ( e1 ) ) ; } callback . onClientConnectionError ( sender , e ) ; return ; } synchronized ( callback ) { callback . recive ( commands , sender ) ; } |
public class TTFFile { /** * Dumps a few informational values to System . out . */
public void printStuff ( ) { } } | System . out . println ( "Font name: " + fontName ) ; System . out . println ( "Full name: " + fullName ) ; System . out . println ( "Family name: " + familyName ) ; System . out . println ( "Subfamily name: " + subFamilyName ) ; System . out . println ( "Notice: " + notice ) ; System . out . println ( "xHeight: " + ( xHeight ) ) ; System . out . println ( "capheight: " + ( capHeight ) ) ; int italic = ( int ) ( italicAngle >> 16 ) ; System . out . println ( "Italic: " + italic ) ; System . out . print ( "ItalicAngle: " + ( short ) ( italicAngle / 0x10000 ) ) ; if ( ( italicAngle % 0x10000 ) > 0 ) { System . out . print ( "." + ( short ) ( ( italicAngle % 0x10000 ) * 1000 ) / 0x10000 ) ; } System . out . println ( ) ; System . out . println ( "Ascender: " + ( ascender ) ) ; System . out . println ( "Descender: " + ( descender ) ) ; System . out . println ( "FontBBox: [" + ( fontBBox1 ) + " " + ( fontBBox2 ) + " " + ( fontBBox3 ) + " " + ( fontBBox4 ) + "]" ) ; |
public class ContentValues { /** * Gets a value and converts it to a Byte .
* @ param key the value to get
* @ return the Byte value , or null if the value is missing or cannot be converted */
public Byte getAsByte ( String key ) { } } | Object value = mValues . get ( key ) ; try { return value != null ? ( ( Number ) value ) . byteValue ( ) : null ; } catch ( ClassCastException e ) { if ( value instanceof CharSequence ) { try { return Byte . valueOf ( value . toString ( ) ) ; } catch ( NumberFormatException e2 ) { DLog . e ( TAG , "Cannot parse Byte value for " + value + " at key " + key ) ; return null ; } } else { DLog . e ( TAG , "Cannot cast value for " + key + " to a Byte: " + value , e ) ; return null ; } } |
public class CmsModulesEditBase { /** * Creates all module folders that are selected in the input form . < p >
* @ param module the module
* @ return the updated module
* @ throws CmsException if somehting goes wrong */
private CmsModule createModuleFolders ( CmsModule module ) throws CmsException { } } | String modulePath = CmsWorkplace . VFS_PATH_MODULES + module . getName ( ) + "/" ; List < CmsExportPoint > exportPoints = module . getExportPoints ( ) ; List < String > resources = module . getResources ( ) ; // set the createModuleFolder flag if any other flag is set
if ( module . isCreateClassesFolder ( ) || module . isCreateElementsFolder ( ) || module . isCreateLibFolder ( ) || module . isCreateResourcesFolder ( ) || module . isCreateSchemasFolder ( ) || module . isCreateTemplateFolder ( ) || module . isCreateFormattersFolder ( ) ) { module . setCreateModuleFolder ( true ) ; } // check if we have to create the module folder
int folderId = CmsResourceTypeFolder . getStaticTypeId ( ) ; if ( module . isCreateModuleFolder ( ) ) { getCms ( ) . createResource ( modulePath , folderId ) ; // add the module folder to the resource list
resources . add ( modulePath ) ; module . setResources ( resources ) ; } // check if we have to create the template folder
if ( module . isCreateTemplateFolder ( ) ) { String path = modulePath + PATH_TEMPLATES ; getCms ( ) . createResource ( path , folderId ) ; } // check if we have to create the elements folder
if ( module . isCreateElementsFolder ( ) ) { String path = modulePath + PATH_ELEMENTS ; getCms ( ) . createResource ( path , folderId ) ; } if ( module . isCreateFormattersFolder ( ) ) { String path = modulePath + PATH_FORMATTERS ; getCms ( ) . createResource ( path , folderId ) ; } // check if we have to create the schemas folder
if ( module . isCreateSchemasFolder ( ) ) { String path = modulePath + PATH_SCHEMAS ; getCms ( ) . createResource ( path , folderId ) ; } // check if we have to create the resources folder
if ( module . isCreateResourcesFolder ( ) ) { String path = modulePath + PATH_RESOURCES ; getCms ( ) . createResource ( path , folderId ) ; } // check if we have to create the lib folder
if ( module . isCreateLibFolder ( ) ) { String path = modulePath + PATH_LIB ; getCms ( ) . createResource ( path , folderId ) ; CmsExportPoint exp = new CmsExportPoint ( path , "WEB-INF/lib/" ) ; exportPoints . add ( exp ) ; module . setExportPoints ( exportPoints ) ; } // check if we have to create the classes folder
if ( module . isCreateClassesFolder ( ) ) { String path = modulePath + PATH_CLASSES ; getCms ( ) . createResource ( path , folderId ) ; CmsExportPoint exp = new CmsExportPoint ( path , "WEB-INF/classes/" ) ; exportPoints . add ( exp ) ; module . setExportPoints ( exportPoints ) ; // now create all subfolders for the package structure
StringTokenizer tok = new StringTokenizer ( m_module . getName ( ) , "." ) ; while ( tok . hasMoreTokens ( ) ) { String folder = tok . nextToken ( ) ; path += folder + "/" ; getCms ( ) . createResource ( path , folderId ) ; } } return module ; |
public class RandomText { /** * Generates a random phone number .
* The phone number has the format : ( XXX ) XXX - YYYY
* @ return a random phone number . */
public static String phone ( ) { } } | StringBuilder result = new StringBuilder ( ) ; result . append ( "(" ) . append ( RandomInteger . nextInteger ( 111 , 999 ) ) . append ( ") " ) . append ( RandomInteger . nextInteger ( 111 , 999 ) ) . append ( "-" ) . append ( RandomInteger . nextInteger ( 0 , 9999 ) ) ; return result . toString ( ) ; |
public class NaetherImpl { /** * / * ( non - Javadoc )
* @ see com . tobedevoured . naether . api . Naether # addDependency ( org . sonatype . aether . graph . Dependency ) */
public void addDependency ( Dependency dependency ) { } } | Dependency newDep = null ; String classifier = dependency . getArtifact ( ) . getClassifier ( ) ; if ( Const . TEST . equals ( classifier ) || Const . TEST_JAR . equals ( classifier ) ) { ArtifactType artifactType = new DefaultArtifactType ( Const . TEST_JAR , Const . JAR , Const . TEST_JAR , null ) ; Artifact artifact = dependency . getArtifact ( ) ; artifact = new DefaultArtifact ( artifact . getGroupId ( ) , artifact . getArtifactId ( ) , null , Const . JAR , artifact . getBaseVersion ( ) , artifactType ) ; newDep = new Dependency ( artifact , dependency . getScope ( ) ) ; } else { newDep = dependency ; } dependencies . add ( newDep ) ; |
public class JmsJcaManagedConnectionFactoryImpl { /** * Creates a JMS connection factory . This connection factory is given a
* < code > JmsJcaConnectionFactory < / code > which , in turn , is associated with
* this managed connection factory and uses the given connection manager .
* @ param connectionManager
* the connection manager
* @ return the JMS connection factory
* @ throws javax . resource . ResourceException
* generic exception */
@ Override final public Object createConnectionFactory ( final ConnectionManager connectionManager ) throws ResourceException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , "createConnectionFactory" , connectionManager ) ; } final JmsJcaConnectionFactoryImpl connectionFactory = new JmsJcaConnectionFactoryImpl ( this , connectionManager ) ; final JmsRAFactoryFactory jmsRAFactory = getJmsRAFactoryFactory ( ) ; final ConnectionFactory jmsConnectionFactory = createJmsConnFactory ( jmsRAFactory , connectionFactory ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( this , TRACE , "createConnectionFactory" , jmsConnectionFactory ) ; } return jmsConnectionFactory ; |
public class StunAttributeFactory { /** * Create a LifetimeAttribute .
* @ param lifetime
* lifetime value
* @ return newly created LifetimeAttribute */
public static LifetimeAttribute createLifetimeAttribute ( int lifetime ) { } } | LifetimeAttribute attribute = new LifetimeAttribute ( ) ; attribute . setLifetime ( lifetime ) ; return attribute ; |
public class StructureTools { /** * Returns and array of all non - Hydrogen atoms in the given Chain ,
* optionally including HET atoms or not Waters are not included .
* @ param c
* @ param hetAtoms
* if true HET atoms are included in array , if false they are not
* @ return */
public static final Atom [ ] getAllNonHAtomArray ( Chain c , boolean hetAtoms ) { } } | List < Atom > atoms = new ArrayList < Atom > ( ) ; for ( Group g : c . getAtomGroups ( ) ) { if ( g . isWater ( ) ) continue ; for ( Atom a : g . getAtoms ( ) ) { if ( a . getElement ( ) == Element . H ) continue ; if ( ! hetAtoms && g . getType ( ) . equals ( GroupType . HETATM ) ) continue ; atoms . add ( a ) ; } } return atoms . toArray ( new Atom [ atoms . size ( ) ] ) ; |
public class ParaClient { /** * Returns a { @ link com . erudika . para . core . User } or an
* { @ link com . erudika . para . core . App } that is currently authenticated .
* @ param < P > an App or User
* @ return a { @ link com . erudika . para . core . User } or an { @ link com . erudika . para . core . App } */
public < P extends ParaObject > P me ( ) { } } | Map < String , Object > data = getEntity ( invokeGet ( "_me" , null ) , Map . class ) ; return ParaObjectUtils . setAnnotatedFields ( data ) ; |
public class CrdtSetDelegate { /** * Updates the set elements .
* @ param elements the elements to update */
private void updateElements ( Map < String , SetElement > elements ) { } } | for ( SetElement element : elements . values ( ) ) { if ( element . isTombstone ( ) ) { if ( remove ( element ) ) { eventListeners . forEach ( listener -> listener . event ( new SetDelegateEvent < > ( SetDelegateEvent . Type . REMOVE , decode ( element . value ( ) ) ) ) ) ; } } else { if ( add ( element ) ) { eventListeners . forEach ( listener -> listener . event ( new SetDelegateEvent < > ( SetDelegateEvent . Type . ADD , decode ( element . value ( ) ) ) ) ) ; } } } |
public class SingleExecutionTime { /** * Provide feedback if a given date matches the cron expression .
* @ param date - ZonedDateTime instance . If null , a NullPointerException will be raised .
* @ return true if date matches cron expression requirements , false otherwise . */
public boolean isMatch ( ZonedDateTime date ) { } } | // Issue # 200 : Truncating the date to the least granular precision supported by different cron systems .
// For Quartz , it ' s seconds while for Unix & Cron4J it ' s minutes .
final boolean isSecondGranularity = cronDefinition . containsFieldDefinition ( SECOND ) ; if ( isSecondGranularity ) { date = date . truncatedTo ( SECONDS ) ; } else { date = date . truncatedTo ( ChronoUnit . MINUTES ) ; } final Optional < ZonedDateTime > last = lastExecution ( date ) ; if ( last . isPresent ( ) ) { final Optional < ZonedDateTime > next = nextExecution ( last . get ( ) ) ; if ( next . isPresent ( ) ) { return next . get ( ) . equals ( date ) ; } else { boolean everythingInRange = false ; try { everythingInRange = dateValuesInExpectedRanges ( nextClosestMatch ( date ) , date ) ; } catch ( final NoSuchValueException ignored ) { // Why is this ignored ?
} try { everythingInRange = dateValuesInExpectedRanges ( previousClosestMatch ( date ) , date ) ; } catch ( final NoSuchValueException ignored ) { // Why is this ignored ?
} return everythingInRange ; } } return false ; |
public class LocalisationManager { /** * Method getXmitQueueIterator
* < p > Return a cloned iterator over the transmit queue points
* for this link .
* @ return Iterator */
public Iterator < PtoPMessageItemStream > getXmitQueueIterator ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getXmitQueueIterator" ) ; Iterator < PtoPMessageItemStream > itr = null ; synchronized ( _xmitQueuePoints ) { itr = ( ( HashMap ) _xmitQueuePoints . clone ( ) ) . values ( ) . iterator ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getXmitQueueIterator" , itr ) ; return itr ; |
public class CSL { /** * Gets or initializes the shared script runner { @ link # sharedRunner }
* @ return the runner
* @ throws IOException if bundles scripts could not be loaded */
private static ScriptRunner getRunner ( ) throws IOException { } } | if ( sharedRunner . get ( ) == null ) { // create JavaScript runner
ScriptRunner runner = ScriptRunnerFactory . createRunner ( ) ; // load bundled scripts
try { runner . loadScript ( CSL . class . getResource ( "dump.js" ) ) ; runner . loadScript ( CSL . class . getResource ( "citeproc.js" ) ) ; runner . loadScript ( CSL . class . getResource ( "formats.js" ) ) ; runner . loadScript ( CSL . class . getResource ( "loadsys.js" ) ) ; } catch ( ScriptRunnerException e ) { // should never happen because bundled JavaScript files
// should be OK indeed
throw new RuntimeException ( "Invalid bundled javascript file" , e ) ; } sharedRunner . set ( runner ) ; } return sharedRunner . get ( ) ; |
public class SpatialAnchorsAccountsInner { /** * Updating a Spatial Anchors Account .
* @ param resourceGroupName Name of an Azure resource group .
* @ param spatialAnchorsAccountName Name of an Mixed Reality Spatial Anchors Account .
* @ param spatialAnchorsAccount Spatial Anchors Account parameter .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws ErrorResponseException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the SpatialAnchorsAccountInner object if successful . */
public SpatialAnchorsAccountInner update ( String resourceGroupName , String spatialAnchorsAccountName , SpatialAnchorsAccountInner spatialAnchorsAccount ) { } } | return updateWithServiceResponseAsync ( resourceGroupName , spatialAnchorsAccountName , spatialAnchorsAccount ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class CmsPreviewUtil { /** * Returns the available image format names for gallery widget mode . < p >
* @ return the available image format names */
public static String [ ] getFormatNames ( ) { } } | JsArrayString formatNames = nativeGetFormatNames ( ) ; if ( ( formatNames == null ) || ( formatNames . length ( ) == 0 ) ) { return null ; } String [ ] result = new String [ formatNames . length ( ) ] ; for ( int i = 0 ; i < formatNames . length ( ) ; i ++ ) { result [ i ] = formatNames . get ( i ) ; } return result ; |
public class ContextFilterFactory { /** * Modify the configuration to set the { @ link ContextFilter } class .
* @ param config Input { @ link Config } .
* @ param klazz Class of desired { @ link ContextFilter } .
* @ return Modified { @ link Config } . */
public static Config setContextFilterClass ( Config config , Class < ? extends ContextFilter > klazz ) { } } | return config . withValue ( CONTEXT_FILTER_CLASS , ConfigValueFactory . fromAnyRef ( klazz . getCanonicalName ( ) ) ) ; |
public class SystemUtil { /** * returns a system setting by either a Java property name or a System environment variable
* @ param name - either a lowercased Java property name ( e . g . lucee . controller . disabled ) or an
* UPPERCASED Environment variable name ( ( e . g . LUCEE _ CONTROLLER _ DISABLED ) )
* @ param defaultValue - value to return if the neither the property nor the environment setting was
* found
* @ return - the value of the property referenced by propOrEnv or the defaultValue if not found */
public static String getSystemPropOrEnvVar ( String name , String defaultValue ) { } } | // env
String value = System . getenv ( name ) ; if ( ! StringUtil . isEmpty ( value ) ) return value ; // prop
value = System . getProperty ( name ) ; if ( ! StringUtil . isEmpty ( value ) ) return value ; // env 2
name = convertSystemPropToEnvVar ( name ) ; value = System . getenv ( name ) ; if ( ! StringUtil . isEmpty ( value ) ) return value ; return defaultValue ; |
public class ImageIngester { /** * If { @ link # ingest ( ) } was successful , returns a String with the
* MIME type of the format .
* @ return MIME type , e . g . < code > image / jpeg < / code > */
public MimeType getMimeType ( ) { } } | if ( format >= 0 && format < MIME_TYPE_STRINGS . length ) { if ( format == FORMAT_JPEG && progressive ) { return new MimeType ( "image/pjpeg" ) ; } return new MimeType ( MIME_TYPE_STRINGS [ format ] ) ; } else { return null ; } |
public class ConditionalProbabilityTable { /** * Creates a CPT using only a subset of the features specified by < tt > categoriesToUse < / tt > .
* @ param dataSet the data set to train from
* @ param categoriesToUse the attributes to use in training . Each value corresponds to the categorical
* index in < tt > dataSet < / tt > , and adding the value { @ link DataSet # getNumCategoricalVars ( ) } , which is
* not a valid index , indicates to used the { @ link ClassificationDataSet # getPredicting ( ) predicting class }
* of the data set in the CPT . */
public void trainC ( ClassificationDataSet dataSet , Set < Integer > categoriesToUse ) { } } | if ( categoriesToUse . size ( ) > dataSet . getNumFeatures ( ) + 1 ) throw new FailedToFitException ( "CPT can not train on a number of features greater then the dataset's feature count. " + "Specified " + categoriesToUse . size ( ) + " but data set has only " + dataSet . getNumFeatures ( ) ) ; CategoricalData [ ] tmp = dataSet . getCategories ( ) ; predicting = dataSet . getPredicting ( ) ; predictingIndex = dataSet . getNumCategoricalVars ( ) ; valid = new HashMap < Integer , CategoricalData > ( ) ; realIndexToCatIndex = new int [ categoriesToUse . size ( ) ] ; catIndexToRealIndex = new int [ dataSet . getNumCategoricalVars ( ) + 1 ] ; // + 1 for the predicting
Arrays . fill ( catIndexToRealIndex , - 1 ) ; // -1s are non existant values
dimSize = new int [ realIndexToCatIndex . length ] ; int flatSize = 1 ; // The number of bins in the n dimensional array
int k = 0 ; for ( int i : categoriesToUse ) { if ( i == predictingIndex ) // The predicint class is treated seperatly
continue ; CategoricalData dataInfo = tmp [ i ] ; flatSize *= dataInfo . getNumOfCategories ( ) ; valid . put ( i , dataInfo ) ; realIndexToCatIndex [ k ] = i ; catIndexToRealIndex [ i ] = k ; dimSize [ k ++ ] = dataInfo . getNumOfCategories ( ) ; } if ( categoriesToUse . contains ( predictingIndex ) ) { // Lastly the predicing quantity
flatSize *= predicting . getNumOfCategories ( ) ; realIndexToCatIndex [ k ] = predictingIndex ; catIndexToRealIndex [ predictingIndex ] = k ; dimSize [ k ] = predicting . getNumOfCategories ( ) ; valid . put ( predictingIndex , predicting ) ; } countArray = new double [ flatSize ] ; Arrays . fill ( countArray , 1 ) ; // Laplace correction
int [ ] cordinate = new int [ dimSize . length ] ; for ( int i = 0 ; i < dataSet . size ( ) ; i ++ ) { DataPoint dp = dataSet . getDataPoint ( i ) ; for ( int j = 0 ; j < realIndexToCatIndex . length ; j ++ ) if ( realIndexToCatIndex [ j ] != predictingIndex ) cordinate [ j ] = dp . getCategoricalValue ( realIndexToCatIndex [ j ] ) ; else cordinate [ j ] = dataSet . getDataPointCategory ( i ) ; countArray [ cordToIndex ( cordinate ) ] += dataSet . getWeight ( i ) ; } |
public class MessageProcessor { /** * Get the Source Batch Handler */
public BatchHandler getSourceBatchHandler ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getSourceBatchHandler" ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getSourceBatchHandler" , _sourceBatchHandler ) ; return _sourceBatchHandler ; |
public class DefaultNodeManager { /** * Deploys a module */
private void doDeployModule ( final Message < JsonObject > message ) { } } | String moduleName = message . body ( ) . getString ( "module" ) ; if ( moduleName == null ) { message . reply ( new JsonObject ( ) . putString ( "status" , "error" ) . putString ( "message" , "No module name specified." ) ) ; return ; } JsonObject config = message . body ( ) . getObject ( "config" ) ; if ( config == null ) { config = new JsonObject ( ) ; } int instances = message . body ( ) . getInteger ( "instances" , 1 ) ; platform . deployModule ( moduleName , config , instances , new Handler < AsyncResult < String > > ( ) { @ Override public void handle ( AsyncResult < String > result ) { if ( result . failed ( ) ) { message . reply ( new JsonObject ( ) . putString ( "status" , "error" ) . putString ( "message" , result . cause ( ) . getMessage ( ) ) ) ; } else { final String deploymentID = result . result ( ) ; context . execute ( new Action < String > ( ) { @ Override public String perform ( ) { deployments . put ( node , message . body ( ) . copy ( ) . putString ( "id" , deploymentID ) . encode ( ) ) ; return deploymentID ; } } , new Handler < AsyncResult < String > > ( ) { @ Override public void handle ( AsyncResult < String > result ) { message . reply ( new JsonObject ( ) . putString ( "status" , "ok" ) . putString ( "id" , deploymentID ) ) ; } } ) ; } } } ) ; |
public class CoronaJobHistory { /** * Log finish time of task .
* @ param taskId task id
* @ param taskType MAP or REDUCE
* @ param finishTime finish timeof task in ms */
public void logTaskFinished ( TaskID taskId , String taskType , long finishTime , Counters counters ) { } } | if ( disableHistory ) { return ; } JobID id = taskId . getJobID ( ) ; if ( ! this . jobId . equals ( id ) ) { throw new RuntimeException ( "JobId from task: " + id + " does not match expected: " + jobId ) ; } if ( null != writers ) { log ( writers , RecordTypes . Task , new Keys [ ] { Keys . TASKID , Keys . TASK_TYPE , Keys . TASK_STATUS , Keys . FINISH_TIME , Keys . COUNTERS } , new String [ ] { taskId . toString ( ) , taskType , Values . SUCCESS . name ( ) , String . valueOf ( finishTime ) , counters . makeEscapedCompactString ( ) } ) ; } |
public class ProposalLineItem { /** * Gets the programmaticCreativeSource value for this ProposalLineItem .
* @ return programmaticCreativeSource * Indicates the { @ link ProgrammaticCreativeSource } of the programmatic
* line item .
* < span class = " constraint Applicable " > This attribute
* is applicable when : < ul > < li > using programmatic guaranteed , using sales
* management . < / li > < li > using programmatic guaranteed , not using sales
* management . < / li > < / ul > < / span > */
public com . google . api . ads . admanager . axis . v201805 . ProgrammaticCreativeSource getProgrammaticCreativeSource ( ) { } } | return programmaticCreativeSource ; |
public class nsacl6 { /** * Use this API to update nsacl6. */
public static base_response update ( nitro_service client , nsacl6 resource ) throws Exception { } } | nsacl6 updateresource = new nsacl6 ( ) ; updateresource . acl6name = resource . acl6name ; updateresource . aclaction = resource . aclaction ; updateresource . srcipv6 = resource . srcipv6 ; updateresource . srcipop = resource . srcipop ; updateresource . srcipv6val = resource . srcipv6val ; updateresource . srcport = resource . srcport ; updateresource . srcportop = resource . srcportop ; updateresource . srcportval = resource . srcportval ; updateresource . destipv6 = resource . destipv6 ; updateresource . destipop = resource . destipop ; updateresource . destipv6val = resource . destipv6val ; updateresource . destport = resource . destport ; updateresource . destportop = resource . destportop ; updateresource . destportval = resource . destportval ; updateresource . srcmac = resource . srcmac ; updateresource . protocol = resource . protocol ; updateresource . protocolnumber = resource . protocolnumber ; updateresource . icmptype = resource . icmptype ; updateresource . icmpcode = resource . icmpcode ; updateresource . vlan = resource . vlan ; updateresource . Interface = resource . Interface ; updateresource . priority = resource . priority ; updateresource . established = resource . established ; return updateresource . update_resource ( client ) ; |
public class UReport { /** * Retrieve the raw statistics this Report would deliver , sorted in the
* order specified ( or the order they were added to the benchmark , if null ) .
* @ param comparator
* The comparator to sort the results by .
* @ return the statistics in the specified order . */
public List < UStats > getStats ( final Comparator < UStats > comparator ) { } } | List < UStats > result = new ArrayList < > ( stats ) ; if ( comparator != null ) { result . sort ( comparator ) ; } return result ; |
public class TZDBTimeZoneNames { /** * / * ( non - Javadoc )
* @ see android . icu . text . TimeZoneNames # getMetaZoneID ( java . lang . String , long ) */
@ Override public String getMetaZoneID ( String tzID , long date ) { } } | return TimeZoneNamesImpl . _getMetaZoneID ( tzID , date ) ; |
public class CqlDataReaderDAO { /** * Converts the rows from the provided iterator into raw metadata . */
private Iterator < RecordEntryRawMetadata > rawMetadataFromCql ( final Iterator < Row > iter ) { } } | return Iterators . transform ( iter , row -> new RecordEntryRawMetadata ( ) . withTimestamp ( TimeUUIDs . getTimeMillis ( getChangeId ( row ) ) ) . withSize ( getValue ( row ) . remaining ( ) ) ) ; |
public class Sniffy { /** * Execute the { @ link Callable # call ( ) } method , record the SQL queries
* and return the { @ link Spy . SpyWithValue } object with stats
* @ param callable code to test
* @ param < V > type of return value
* @ return statistics on executed queries
* @ throws Exception if underlying code under test throws an Exception
* @ since 3.1 */
@ SuppressWarnings ( "unchecked" ) public static < V > Spy . SpyWithValue < V > call ( Callable < V > callable ) throws Exception { } } | return spy ( ) . call ( callable ) ; |
public class Mtrie { /** * actually removed rather than de - duplicated . */
public boolean rm ( Msg msg , Pipe pipe ) { } } | assert ( msg != null ) ; assert ( pipe != null ) ; return rmHelper ( msg , 1 , msg . size ( ) - 1 , pipe ) ; |
public class IonReaderTextRawTokensX { /** * can unread it */
private final int load_exponent ( StringBuilder sb ) throws IOException { } } | int c = read_char ( ) ; if ( c == '-' || c == '+' ) { sb . append ( ( char ) c ) ; c = read_char ( ) ; } c = load_digits ( sb , c ) ; if ( c == '.' ) { sb . append ( ( char ) c ) ; c = read_char ( ) ; c = load_digits ( sb , c ) ; } return c ; |
public class MatrixExtensions { /** * Replies the division of this matrix by the given scalar : { @ code left / right } .
* < p > This function is an implementation of the operator for
* the languages that defined or based on the
* < a href = " https : / / www . eclipse . org / Xtext / " > Xtext framework < / a > .
* < p > The operation { @ code right / left } is supported by { @ link Matrix4d # operator _ divide ( double ) } .
* @ param < M > the type of the matrix .
* @ param left the scalar .
* @ param right the matrix .
* @ return the division of the matrix by the scalar .
* @ see Matrix4d # mul ( double )
* @ see Matrix4d # operator _ divide ( double ) */
@ Pure @ XtextOperator ( "/" ) @ SuppressWarnings ( "unchecked" ) public static < M extends Matrix4d > M operator_divide ( double left , M right ) { } } | assert right != null : AssertMessages . notNullParameter ( 1 ) ; final M result = ( M ) right . clone ( ) ; result . set ( left / right . getM00 ( ) , left / right . getM01 ( ) , left / right . getM02 ( ) , left / right . getM03 ( ) , left / right . getM10 ( ) , left / right . getM11 ( ) , left / right . getM12 ( ) , left / right . getM13 ( ) , left / right . getM20 ( ) , left / right . getM21 ( ) , left / right . getM22 ( ) , left / right . getM23 ( ) , left / right . getM30 ( ) , left / right . getM31 ( ) , left / right . getM32 ( ) , left / right . getM33 ( ) ) ; return result ; |
public class RestoreManagerImpl { /** * ( non - Javadoc )
* @ see
* org . duracloud . snapshot . service . restore . RestoreManager # transitionRestoreStatus
* ( java . lang . Long , org . duracloud . snapshot . dto . RestoreStatus ,
* java . lang . String ) */
@ Override @ Transactional public Restoration transitionRestoreStatus ( String restorationId , RestoreStatus status , String message ) throws InvalidStateTransitionException , RestorationNotFoundException { } } | Restoration restoration = getRestoration ( restorationId ) ; return _transitionRestoreStatus ( status , message , restoration ) ; |
public class DateFormatHelper { /** * 根据字符串构造实例 。
* @ param date
* 日期字符串 。
* @ param format
* 格式 , 形式见 { @ code org . joda . time . format . DateTimeFormat } 。
* @ return 日期 */
public static Calendar parse ( final String date , final String format ) { } } | return parse ( date , DateTimeFormat . forPattern ( format ) ) ; |
public class MapUtils { /** * Extract a value from a map .
* @ param map
* @ param key
* @ param clazz
* @ return */
public static < T > T getValue ( Map < String , Object > map , String key , Class < T > clazz ) { } } | return map != null ? ValueUtils . convertValue ( map . get ( key ) , clazz ) : null ; |
public class ConfigurationUtils { /** * Finds the icon associated with an application template .
* @ param name the application or template name
* @ param qualifier the template qualifier or < code > null < / code > for an application
* @ param configurationDirectory the DM ' s configuration directory
* @ return an existing file , or null if no icon was found */
public static File findIcon ( String name , String qualifier , File configurationDirectory ) { } } | // Deal with an invalid directory
if ( configurationDirectory == null ) return null ; // Find the root directory
File root ; if ( ! Utils . isEmptyOrWhitespaces ( qualifier ) ) { ApplicationTemplate tpl = new ApplicationTemplate ( name ) . version ( qualifier ) ; root = ConfigurationUtils . findTemplateDirectory ( tpl , configurationDirectory ) ; } else { root = ConfigurationUtils . findApplicationDirectory ( name , configurationDirectory ) ; } // Find an icon in the directory
return IconUtils . findIcon ( root ) ; |
public class RestReportingEngine { /** * { @ inheritDoc } */
@ Override @ GET @ Path ( "/attacks/count-by-user" ) public int countAttacksByUser ( @ QueryParam ( "earliest" ) String earliest , @ QueryParam ( "username" ) String username ) throws NotAuthorizedException { } } | accessControlUtils . checkAuthorization ( Action . EXECUTE_REPORT , requestContext ) ; SearchCriteria criteria = new SearchCriteria ( ) . setEarliest ( earliest ) . setUser ( new User ( username ) ) ; return appSensorServer . getAttackStore ( ) . findAttacks ( criteria ) . size ( ) ; |
public class SeleniumInterpreter { /** * { @ inheritDoc } */
@ Override public void interpret ( Specification specification ) { } } | SeleniumServer seleniumServer = null ; try { seleniumServer = new SeleniumServer ( getRemoteControlConfiguration ( ) ) ; seleniumServer . start ( ) ; startCommandProcessor ( ) ; super . interpret ( specification ) ; } catch ( Exception e ) { throw ExceptionImposter . imposterize ( e ) ; } finally { stopCommandProcessor ( ) ; stop ( seleniumServer ) ; } |
public class AbstractValidateableDialogPreference { /** * Obtains , whether the value of the view should be validated , when the view loses its focus , or
* not , from a specific typed array .
* @ param typedArray
* The typed array , it should be obtained from , whether the value of the view should be
* validated , when the view loses its focus , or not , as an instance of the class { @ link
* TypedArray } . The typed array may not be null */
private void obtainValidateOnFocusLost ( @ NonNull final TypedArray typedArray ) { } } | boolean defaultValue = getContext ( ) . getResources ( ) . getBoolean ( R . bool . validateable_dialog_preference_default_validate_on_focus_lost ) ; validateOnFocusLost ( typedArray . getBoolean ( R . styleable . AbstractValidateableView_validateOnFocusLost , defaultValue ) ) ; |
public class AnimatablePathValueParser { /** * Returns either an { @ link AnimatablePathValue } or an { @ link AnimatableSplitDimensionPathValue } . */
static AnimatableValue < PointF , PointF > parseSplitPath ( JsonReader reader , LottieComposition composition ) throws IOException { } } | AnimatablePathValue pathAnimation = null ; AnimatableFloatValue xAnimation = null ; AnimatableFloatValue yAnimation = null ; boolean hasExpressions = false ; reader . beginObject ( ) ; while ( reader . peek ( ) != JsonToken . END_OBJECT ) { switch ( reader . nextName ( ) ) { case "k" : pathAnimation = AnimatablePathValueParser . parse ( reader , composition ) ; break ; case "x" : if ( reader . peek ( ) == JsonToken . STRING ) { hasExpressions = true ; reader . skipValue ( ) ; } else { xAnimation = AnimatableValueParser . parseFloat ( reader , composition ) ; } break ; case "y" : if ( reader . peek ( ) == JsonToken . STRING ) { hasExpressions = true ; reader . skipValue ( ) ; } else { yAnimation = AnimatableValueParser . parseFloat ( reader , composition ) ; } break ; default : reader . skipValue ( ) ; } } reader . endObject ( ) ; if ( hasExpressions ) { composition . addWarning ( "Lottie doesn't support expressions." ) ; } if ( pathAnimation != null ) { return pathAnimation ; } return new AnimatableSplitDimensionPathValue ( xAnimation , yAnimation ) ; |
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link PointPropertyType } { @ code > }
* @ param value
* Java instance representing xml element ' s value .
* @ return
* the new instance of { @ link JAXBElement } { @ code < } { @ link PointPropertyType } { @ code > } */
@ XmlElementDecl ( namespace = "http://www.opengis.net/gml" , name = "pointMember" ) public JAXBElement < PointPropertyType > createPointMember ( PointPropertyType value ) { } } | return new JAXBElement < PointPropertyType > ( _PointMember_QNAME , PointPropertyType . class , null , value ) ; |
public class LifecycleApproveChaincodeDefinitionForMyOrgRequest { /** * The chaincode validation parameter . Only this or chaincode endorsement policy { @ link # setChaincodeEndorsementPolicy ( LifecycleChaincodeEndorsementPolicy ) } may be set at any one time .
* @ param validationParameter
* @ throws InvalidArgumentException */
public void setValidationParameter ( byte [ ] validationParameter ) throws InvalidArgumentException { } } | if ( null == validationParameter ) { throw new InvalidArgumentException ( "The valdiationParameter parameter can not be null." ) ; } this . validationParameter = ByteString . copyFrom ( validationParameter ) ; |
public class Validate { /** * Method without varargs to increase performance */
public static < T extends CharSequence > T notBlank ( final T chars , final String message ) { } } | return INSTANCE . notBlank ( chars , message ) ; |
public class DocumentReadTransform { /** * clean up by deleting the read document and the example transform */
public static void tearDownExample ( String host , int port , String user , String password , Authentication authType ) throws ResourceNotFoundException , ForbiddenUserException , FailedRequestException { } } | DatabaseClient client = DatabaseClientFactory . newClient ( host , port , user , password , authType ) ; XMLDocumentManager docMgr = client . newXMLDocumentManager ( ) ; docMgr . delete ( "/example/flipper.xml" ) ; TransformExtensionsManager transMgr = client . newServerConfigManager ( ) . newTransformExtensionsManager ( ) ; transMgr . deleteTransform ( TRANSFORM_NAME ) ; client . release ( ) ; |
public class LazyResponseWrapper { /** * 代理getOutputStream , 真正write的时候才获取 */
public ServletOutputStream getOutputStream ( ) throws IOException { } } | return new ServletOutputStream ( ) { protected OutputStream proxy ; public void write ( int b ) throws IOException { if ( proxy == null ) proxy = getResponse ( ) . getOutputStream ( ) ; proxy . write ( b ) ; } public void write ( byte [ ] paramArrayOfByte , int off , int len ) throws IOException { if ( proxy == null ) proxy = getResponse ( ) . getOutputStream ( ) ; proxy . write ( paramArrayOfByte , off , len ) ; } } ; |
public class CmsSqlBooleanClause { /** * Creates a boolean " OR " expression . < p >
* @ param fragments the operands of the " OR "
* @ return the combined expressiong */
public static CmsSqlBooleanClause makeOr ( I_CmsQueryFragment ... fragments ) { } } | CmsSqlBooleanClause result = new CmsSqlBooleanClause ( "OR" ) ; for ( I_CmsQueryFragment fragment : fragments ) { result . addCondition ( fragment ) ; } return result ; |
public class GetStagesResult { /** * The elements from this collection .
* @ param items
* The elements from this collection . */
public void setItems ( java . util . Collection < Stage > items ) { } } | if ( items == null ) { this . items = null ; return ; } this . items = new java . util . ArrayList < Stage > ( items ) ; |
public class ServiceManagerSparql { /** * Obtains the list of operation URIs for a given Operation
* @ param serviceUri the service URI
* @ return a List of URIs with the operations provided by the service . If there are no operations , the List should be empty NOT null . */
@ Override public Set < URI > listOperations ( URI serviceUri ) { } } | if ( serviceUri == null || ! serviceUri . isAbsolute ( ) ) { log . warn ( "The Service URI is either absent or relative. Provide an absolute URI" ) ; return ImmutableSet . of ( ) ; } URI graphUri ; try { graphUri = getGraphUriForElement ( serviceUri ) ; } catch ( URISyntaxException e ) { log . warn ( "The namespace of the URI of the service is incorrect." , e ) ; return ImmutableSet . of ( ) ; } if ( graphUri == null ) { log . warn ( "Could not obtain a graph URI for the element. The URI may not be managed by the server - " + serviceUri ) ; return ImmutableSet . of ( ) ; } String queryStr = new StringBuilder ( ) . append ( "SELECT DISTINCT ?op WHERE { \n" ) . append ( " GRAPH <" ) . append ( graphUri . toASCIIString ( ) ) . append ( "> { \n" ) . append ( " <" ) . append ( serviceUri . toASCIIString ( ) ) . append ( "> " ) . append ( "<" ) . append ( MSM . hasOperation . getURI ( ) ) . append ( ">" ) . append ( " ?op . " ) . append ( " ?op " ) . append ( "<" ) . append ( RDF . type . getURI ( ) ) . append ( ">" ) . append ( " " ) . append ( "<" ) . append ( MSM . Operation . getURI ( ) ) . append ( "> . \n" ) . append ( " } \n " ) . append ( "} \n " ) . toString ( ) ; return this . graphStoreManager . listResourcesByQuery ( queryStr , "op" ) ; |
public class BusItineraryHalt { /** * Replies the position of the bus halt on the road .
* The replied position may differ from the
* position of the associated bus stop because the
* position on the road is a projection of the stop ' s position
* on the road .
* @ return the 2D position or < code > null < / code > if
* the halt is not associated to a road segment . */
@ Pure public Point2d getPosition2D ( ) { } } | final Point1d p1d5 = getPosition1D ( ) ; if ( p1d5 != null ) { final Point2d pos = new Point2d ( ) ; p1d5 . getSegment ( ) . projectsOnPlane ( p1d5 . getCurvilineCoordinate ( ) , p1d5 . getLateralDistance ( ) , pos , null ) ; return pos ; } return null ; |
public class CountrySpinnerAdapter { /** * Drop down item view
* @ param position position of item
* @ param convertView View of item
* @ param parent parent view of item ' s view
* @ return covertView */
@ Override public View getDropDownView ( int position , View convertView , ViewGroup parent ) { } } | final ViewHolder viewHolder ; if ( convertView == null ) { convertView = mLayoutInflater . inflate ( R . layout . item_country , parent , false ) ; viewHolder = new ViewHolder ( ) ; viewHolder . mImageView = ( ImageView ) convertView . findViewById ( R . id . intl_phone_edit__country__item_image ) ; viewHolder . mNameView = ( TextView ) convertView . findViewById ( R . id . intl_phone_edit__country__item_name ) ; viewHolder . mDialCode = ( TextView ) convertView . findViewById ( R . id . intl_phone_edit__country__item_dialcode ) ; convertView . setTag ( viewHolder ) ; } else { viewHolder = ( ViewHolder ) convertView . getTag ( ) ; } Country country = getItem ( position ) ; viewHolder . mImageView . setImageResource ( getFlagResource ( country ) ) ; viewHolder . mNameView . setText ( country . getName ( ) ) ; viewHolder . mDialCode . setText ( String . format ( "+%s" , country . getDialCode ( ) ) ) ; return convertView ; |
public class BootstrapDrawableFactory { /** * Generates a Drawable for a Bootstrap Label background , according to state parameters
* @ param context the current context
* @ param bootstrapBrand the BootstrapBrand theming whose colors should be used
* @ param rounded whether the corners should be rounded or not
* @ param height the view height in px
* @ return the Bootstrap Label background */
static Drawable bootstrapLabel ( Context context , BootstrapBrand bootstrapBrand , boolean rounded , float height ) { } } | int cornerRadius = ( int ) DimenUtils . pixelsFromDpResource ( context , R . dimen . bootstrap_default_corner_radius ) ; GradientDrawable drawable = new GradientDrawable ( ) ; drawable . setColor ( bootstrapBrand . defaultFill ( context ) ) ; // corner radius should be half height if rounded as a " Pill " label
drawable . setCornerRadius ( rounded ? height / 2 : cornerRadius ) ; return drawable ; |
public class FlushManager { /** * Adds the nodes to flush stack .
* @ param node
* the node
* @ param eventType
* the event type */
private void addNodesToFlushStack ( Node node , EventType eventType ) { } } | Map < NodeLink , Node > children = node . getChildren ( ) ; performOperation ( node , eventType ) ; // If this is a leaf node ( not having any child , no need to go any
// deeper
if ( children != null ) { Map < NodeLink , Node > oneToOneChildren = new HashMap < NodeLink , Node > ( ) ; Map < NodeLink , Node > oneToManyChildren = new HashMap < NodeLink , Node > ( ) ; Map < NodeLink , Node > manyToOneChildren = new HashMap < NodeLink , Node > ( ) ; Map < NodeLink , Node > manyToManyChildren = new HashMap < NodeLink , Node > ( ) ; for ( NodeLink nodeLink : children . keySet ( ) ) { List < CascadeType > cascadeTypes = ( List < CascadeType > ) nodeLink . getLinkProperty ( LinkProperty . CASCADE ) ; if ( cascadeTypes . contains ( cascadePermission . get ( eventType ) . get ( 0 ) ) || cascadeTypes . contains ( cascadePermission . get ( eventType ) . get ( 1 ) ) ) { Relation . ForeignKey multiplicity = nodeLink . getMultiplicity ( ) ; Node childNode = children . get ( nodeLink ) ; switch ( multiplicity ) { case ONE_TO_ONE : oneToOneChildren . put ( nodeLink , childNode ) ; break ; case ONE_TO_MANY : oneToManyChildren . put ( nodeLink , childNode ) ; break ; case MANY_TO_ONE : manyToOneChildren . put ( nodeLink , childNode ) ; break ; case MANY_TO_MANY : manyToManyChildren . put ( nodeLink , childNode ) ; break ; } } } // Process One - To - Many children
for ( NodeLink nodeLink : oneToManyChildren . keySet ( ) ) { // Process child node Graph recursively first
Node childNode = children . get ( nodeLink ) ; if ( childNode != null && ! childNode . isTraversed ( ) ) { addNodesToFlushStack ( childNode , eventType ) ; } } // Process Many - To - Many children
for ( NodeLink nodeLink : manyToManyChildren . keySet ( ) ) { if ( ! node . isTraversed ( ) && ! ( Boolean ) nodeLink . getLinkProperty ( LinkProperty . IS_RELATED_VIA_JOIN_TABLE ) ) { // Push this node to stack
node . setTraversed ( true ) ; stackQueue . push ( node ) ; logEvent ( node , eventType ) ; } Node childNode = children . get ( nodeLink ) ; if ( childNode != null ) { // Extract information required to be persisted into
// Join
// Table
if ( node . isDirty ( ) && ! node . isTraversed ( ) ) { // M - 2 - M relation fields that are Set or List are joined
// by join table .
// M - 2 - M relation fields that are Map aren ' t joined by
// Join table
JoinTableMetadata jtmd = ( JoinTableMetadata ) nodeLink . getLinkProperty ( LinkProperty . JOIN_TABLE_METADATA ) ; if ( jtmd != null ) { String joinColumnName = ( String ) jtmd . getJoinColumns ( ) . toArray ( ) [ 0 ] ; String inverseJoinColumnName = ( String ) jtmd . getInverseJoinColumns ( ) . toArray ( ) [ 0 ] ; Object entityId = node . getEntityId ( ) ; Object childId = childNode . getEntityId ( ) ; Set < Object > childValues = new HashSet < Object > ( ) ; childValues . add ( childId ) ; OPERATION operation = null ; if ( node . getCurrentNodeState ( ) . getClass ( ) . equals ( ManagedState . class ) ) { operation = OPERATION . INSERT ; } else if ( node . getCurrentNodeState ( ) . getClass ( ) . equals ( RemovedState . class ) ) { operation = OPERATION . DELETE ; } addJoinTableData ( operation , jtmd . getJoinTableSchema ( ) , jtmd . getJoinTableName ( ) , joinColumnName , inverseJoinColumnName , node . getDataClass ( ) , entityId , childValues ) ; } } // Process child node Graph recursively first
if ( ! childNode . isTraversed ( ) ) { addNodesToFlushStack ( childNode , eventType ) ; } } } // Process One - To - One children
for ( NodeLink nodeLink : oneToOneChildren . keySet ( ) ) { if ( ! node . isTraversed ( ) ) { // Push this node to stack
node . setTraversed ( true ) ; stackQueue . push ( node ) ; logEvent ( node , eventType ) ; } // Process child node Graph recursively
Node childNode = children . get ( nodeLink ) ; addNodesToFlushStack ( childNode , eventType ) ; } // Process Many - To - One children
for ( NodeLink nodeLink : manyToOneChildren . keySet ( ) ) { if ( ! node . isTraversed ( ) ) { // Push this node to stack
node . setTraversed ( true ) ; stackQueue . push ( node ) ; logEvent ( node , eventType ) ; } // Child node of this node
Node childNode = children . get ( nodeLink ) ; // Process all parents of child node with Many - To - One
// relationship first
Map < NodeLink , Node > parents = childNode . getParents ( ) ; for ( NodeLink parentLink : parents . keySet ( ) ) { List < CascadeType > cascadeTypes = ( List < CascadeType > ) nodeLink . getLinkProperty ( LinkProperty . CASCADE ) ; if ( cascadeTypes . contains ( cascadePermission . get ( eventType ) . get ( 0 ) ) || cascadeTypes . contains ( cascadePermission . get ( eventType ) . get ( 1 ) ) ) { Relation . ForeignKey multiplicity = parentLink . getMultiplicity ( ) ; Node parentNode = parents . get ( parentLink ) ; // performOperation ( parentNode , eventType ) ;
if ( multiplicity . equals ( Relation . ForeignKey . MANY_TO_ONE ) ) { if ( ! parentNode . isTraversed ( ) && parentNode . isDirty ( ) ) { addNodesToFlushStack ( parentNode , eventType ) ; } } } } // Finally process this child node
if ( ! childNode . isTraversed ( ) && childNode . isDirty ( ) ) { addNodesToFlushStack ( childNode , eventType ) ; } else if ( ! childNode . isDirty ( ) ) { childNode . setTraversed ( true ) ; stackQueue . push ( childNode ) ; logEvent ( childNode , eventType ) ; } } } // Finally , if this node itself is not traversed yet , ( as may happen
// in
// 1-1 and M - 1
// cases ) , push it to stack
if ( ! node . isTraversed ( ) && node . isDirty ( ) ) { node . setTraversed ( true ) ; stackQueue . push ( node ) ; logEvent ( node , eventType ) ; } |
public class BatchGetOnPremisesInstancesResult { /** * Information about the on - premises instances .
* @ param instanceInfos
* Information about the on - premises instances . */
public void setInstanceInfos ( java . util . Collection < InstanceInfo > instanceInfos ) { } } | if ( instanceInfos == null ) { this . instanceInfos = null ; return ; } this . instanceInfos = new com . amazonaws . internal . SdkInternalList < InstanceInfo > ( instanceInfos ) ; |
public class IsNullOperator { /** * ( non - Javadoc )
* @ see net . timewalker . ffmq4 . common . message . selector . expression . SelectorNode # evaluate ( javax . jms . Message ) */
@ Override public Object evaluate ( Message message ) throws JMSException { } } | Object operandValue = operand . evaluate ( message ) ; return operandValue == null ? Boolean . TRUE : Boolean . FALSE ; |
public class BaseSerializer { /** * Serialize a list of DataActions */
public String serializeDataActionList ( List < DataAction > list ) { } } | ObjectMapper om = getObjectMapper ( ) ; try { return om . writeValueAsString ( new ListWrappers . DataActionList ( list ) ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } |
public class MutableDateTime { /** * Set the time from fields .
* The date part of this object will be unaffected .
* @ param hour the hour
* @ param minuteOfHour the minute of the hour
* @ param secondOfMinute the second of the minute
* @ param millisOfSecond the millisecond of the second
* @ throws IllegalArgumentException if the value is invalid */
public void setTime ( final int hour , final int minuteOfHour , final int secondOfMinute , final int millisOfSecond ) { } } | long instant = getChronology ( ) . getDateTimeMillis ( getMillis ( ) , hour , minuteOfHour , secondOfMinute , millisOfSecond ) ; setMillis ( instant ) ; |
public class BigMoney { /** * Returns a copy of this monetary value with the amount subtracted .
* This subtracts the specified amount from this monetary amount , returning a new object .
* No precision is lost in the result .
* The scale of the result will be the maximum of the two scales .
* For example , ' USD 25.95 ' minus ' 3.021 ' gives ' USD 22.929 ' .
* This instance is immutable and unaffected by this method .
* @ param amountToSubtract the monetary value to subtract , not null
* @ return the new instance with the input amount subtracted , never null */
public BigMoney minus ( BigDecimal amountToSubtract ) { } } | MoneyUtils . checkNotNull ( amountToSubtract , "Amount must not be null" ) ; if ( amountToSubtract . compareTo ( BigDecimal . ZERO ) == 0 ) { return this ; } BigDecimal newAmount = amount . subtract ( amountToSubtract ) ; return BigMoney . of ( currency , newAmount ) ; |
public class InternalXtypeLexer { /** * $ ANTLR start " T _ _ 12" */
public final void mT__12 ( ) throws RecognitionException { } } | try { int _type = T__12 ; int _channel = DEFAULT_TOKEN_CHANNEL ; // InternalXtype . g : 13:7 : ( ' ( ' )
// InternalXtype . g : 13:9 : ' ( '
{ match ( '(' ) ; } state . type = _type ; state . channel = _channel ; } finally { } |
public class VerificationConditionGenerator { /** * Construct a function or method prototype with a given name and type . The
* function or method can then be called elsewhere as an uninterpreted function .
* The function or method doesn ' t have a body but is used as a name to be
* referred to from assertions .
* @ param declaration
* - - - the function or method declaration in question
* @ param wyalFile
* - - - the file onto which this function is created .
* @ return */
private void createFunctionOrMethodPrototype ( WyilFile . Decl . FunctionOrMethod declaration ) { } } | Tuple < WyilFile . Decl . Variable > params = declaration . getParameters ( ) ; Tuple < WyilFile . Decl . Variable > returns = declaration . getReturns ( ) ; WyalFile . VariableDeclaration [ ] parameters = new WyalFile . VariableDeclaration [ params . size ( ) ] ; // second , set initial environment
for ( int i = 0 ; i != params . size ( ) ; ++ i ) { WyilFile . Decl . Variable var = params . get ( i ) ; WyalFile . Type parameterType = convert ( var . getType ( ) , declaration ) ; WyalFile . Identifier parameterName = new WyalFile . Identifier ( var . getName ( ) . get ( ) ) ; parameters [ i ] = new WyalFile . VariableDeclaration ( parameterType , parameterName ) ; } WyalFile . VariableDeclaration [ ] wyalReturns = new WyalFile . VariableDeclaration [ returns . size ( ) ] ; // second , set initial environment
for ( int i = 0 ; i != returns . size ( ) ; ++ i ) { WyilFile . Decl . Variable var = returns . get ( i ) ; WyalFile . Type returnType = convert ( var . getType ( ) , declaration ) ; WyalFile . Identifier returnName = new WyalFile . Identifier ( var . getName ( ) . get ( ) ) ; wyalReturns [ i ] = new WyalFile . VariableDeclaration ( returnType , returnName ) ; } Name name = declaration . getQualifiedName ( ) . toName ( ) ; wyalFile . allocate ( new Declaration . Named . Function ( name , parameters , wyalReturns ) ) ; |
public class ChannelFrameworkImpl { /** * @ see com . ibm . wsspi . channelfw . ChannelFramework # stopChain ( String , long ) */
@ Override public synchronized void stopChain ( String chainName , long millisec ) throws ChannelException , ChainException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "stopChain: " + chainName + " time=" + millisec ) ; } if ( null == chainName ) { throw new InvalidChainNameException ( "Null chain name" ) ; } if ( millisec < 0 ) { throw new ChainTimerException ( "Invalid time length give to stopChain, " + millisec ) ; } // Verify the chain is found in the runtime .
Chain chain = getRunningChain ( chainName ) ; if ( null == chain ) { // Due to timing windows ( i . e . multiple channel providers going away ) , there is
// a race to stop chains . This is not a notable condition : the chain can only be stopped
// once .
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "stopChain " + chainName , "chain is not running" ) ; } return ; } // Ensure we have an inbound chain .
if ( FlowType . OUTBOUND . equals ( chain . getChainData ( ) . getType ( ) ) ) { throw new InvalidChainNameException ( "Outbound chain cannot use this interface." ) ; } stopChainInternal ( chain , millisec ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "stopChain" ) ; } |
public class IntervalTree { /** * / * From CLR */
private void rotateLeft ( TreeEntry < E > p ) { } } | if ( p != null ) { TreeEntry < E > r = p . right ; p . right = r . left ; if ( r . left != null ) { r . left . parent = p ; } r . parent = p . parent ; if ( p . parent == null ) { root = r ; } else if ( p . parent . left == p ) { p . parent . left = r ; } else { p . parent . right = r ; } r . left = p ; p . parent = r ; // Original C code :
// x - > maxHigh = ITMax ( x - > left - > maxHigh , ITMax ( x - > right - > maxHigh , x - > high ) )
// Original C Code :
// y - > maxHigh = ITMax ( x - > maxHigh , ITMax ( y - > right - > maxHigh , y - > high ) )
p . maxHigh = Math . max ( p . left != null ? p . left . maxHigh : Long . MIN_VALUE , Math . max ( p . right != null ? p . right . maxHigh : Long . MIN_VALUE , p . high ) ) ; r . maxHigh = Math . max ( p . maxHigh , Math . max ( r . right != null ? r . right . maxHigh : Long . MIN_VALUE , r . high ) ) ; } |
public class CmsObject { /** * Moves a resource to the " lost and found " folder . < p >
* The " lost and found " folder is a special system folder .
* This operation is used e . g . during import of resources
* when a resource with the same name but a different resource ID
* already exists in the VFS . In this case , the imported resource is
* moved to the " lost and found " folder . < p >
* @ param resourcename the name of the resource to move to " lost and found " ( full current site relative path )
* @ return the name of the resource inside the " lost and found " folder
* @ throws CmsException if something goes wrong
* @ see # getLostAndFoundName ( String ) */
public String moveToLostAndFound ( String resourcename ) throws CmsException { } } | CmsResource resource = readResource ( resourcename , CmsResourceFilter . ALL ) ; return m_securityManager . moveToLostAndFound ( m_context , resource , false ) ; |
public class Value { /** * Returns a complete string representation of this
* value .
* @ return a complete string representation of this
* value . */
public String getCompleteValue ( ) { } } | if ( concatValue == null ) { return value ; } else { StringBuffer buf = new StringBuffer ( value ) ; buf . append ( concatValue . getCompleteValue ( ) ) ; return buf . toString ( ) ; } |
public class ST_Split { /** * Splits a Polygon with a LineString .
* @ param polygon
* @ param lineString
* @ return */
private static Collection < Polygon > splitPolygonizer ( Polygon polygon , LineString lineString ) throws SQLException { } } | LinkedList < LineString > result = new LinkedList < LineString > ( ) ; ST_ToMultiSegments . createSegments ( polygon . getExteriorRing ( ) , result ) ; result . add ( lineString ) ; int holes = polygon . getNumInteriorRing ( ) ; for ( int i = 0 ; i < holes ; i ++ ) { ST_ToMultiSegments . createSegments ( polygon . getInteriorRingN ( i ) , result ) ; } // Perform union of all extracted LineStrings ( the edge - noding process )
UnaryUnionOp uOp = new UnaryUnionOp ( result ) ; Geometry union = uOp . union ( ) ; // Create polygons from unioned LineStrings
Polygonizer polygonizer = new Polygonizer ( ) ; polygonizer . add ( union ) ; Collection < Polygon > polygons = polygonizer . getPolygons ( ) ; if ( polygons . size ( ) > 1 ) { return polygons ; } return null ; |
public class Validate { /** * Checks if the given double is a probability ( lies between 0.0 and 1.0 , inclusive ) .
* @ param value The double value to validate .
* @ param message The error message to include in the exception in case the validation fails .
* @ throws ParameterException if the given double value lies outside the bounds . */
public static void probability ( Double value , String message ) { } } | if ( ! validation ) return ; Validate . inclusiveBetween ( 0.0 , 1.0 , value , message ) ; |
public class MapContentHandler { /** * Register a new content handler .
* @ param clazz
* the class of the content
* @ param handler
* the content handler */
public void addContentHandler ( Class < ? extends Content > clazz , JavaMailContentHandler handler ) { } } | map . put ( clazz , handler ) ; |
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link DocumentType . Add } { @ code > } } */
@ XmlElementDecl ( namespace = "urn:ietf:params:xml:ns:xcap-diff" , name = "add" , scope = DocumentType . class ) public JAXBElement < DocumentType . Add > createDocumentTypeAdd ( DocumentType . Add value ) { } } | return new JAXBElement < DocumentType . Add > ( _DocumentTypeAdd_QNAME , DocumentType . Add . class , DocumentType . class , value ) ; |
public class RefasterJsScanner { /** * Loads the RefasterJs template . This must be called before the scanner is used . */
public void loadRefasterJsTemplate ( String refasterjsTemplate ) throws IOException { } } | checkState ( templateJs == null , "Can't load RefasterJs template since a template is already loaded." ) ; this . templateJs = Thread . currentThread ( ) . getContextClassLoader ( ) . getResource ( refasterjsTemplate ) != null ? Resources . toString ( Resources . getResource ( refasterjsTemplate ) , UTF_8 ) : Files . asCharSource ( new File ( refasterjsTemplate ) , UTF_8 ) . read ( ) ; |
public class ServiceConfiguration { /** * The DNS names for the service .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setBaseEndpointDnsNames ( java . util . Collection ) } or { @ link # withBaseEndpointDnsNames ( java . util . Collection ) }
* if you want to override the existing values .
* @ param baseEndpointDnsNames
* The DNS names for the service .
* @ return Returns a reference to this object so that method calls can be chained together . */
public ServiceConfiguration withBaseEndpointDnsNames ( String ... baseEndpointDnsNames ) { } } | if ( this . baseEndpointDnsNames == null ) { setBaseEndpointDnsNames ( new com . amazonaws . internal . SdkInternalList < String > ( baseEndpointDnsNames . length ) ) ; } for ( String ele : baseEndpointDnsNames ) { this . baseEndpointDnsNames . add ( ele ) ; } return this ; |
public class NodeUtil { /** * Returns true if the node is a lhs value of a destructuring assignment .
* < p > For example , x in { @ code var [ x ] = [ 1 ] ; } , { @ code var [ . . . x ] = [ 1 ] ; } , and { @ code var { a : x } =
* { a : 1 } } or a . b in { @ code ( [ a . b ] = [ 1 ] ) ; } or { @ code ( { key : a . b } = { key : 1 } ) ; } */
public static boolean isLhsByDestructuring ( Node n ) { } } | switch ( n . getToken ( ) ) { case NAME : case GETPROP : case GETELEM : return isLhsByDestructuringHelper ( n ) ; default : return false ; } |
public class CmsSearchTab { /** * Sets the form fields to the values from the stored gallery search . < p >
* @ param search a previously stored gallery search */
public void fillParams ( CmsGallerySearchBean search ) { } } | m_localeSelection . setFormValue ( search . getLocale ( ) , false ) ; m_searchInput . setFormValueAsString ( search . getQuery ( ) ) ; m_includeExpiredCheckBox . setChecked ( search . isIncludeExpired ( ) ) ; if ( search . getDateCreatedStart ( ) > 9 ) { m_dateCreatedStartDateBox . setValue ( new Date ( search . getDateCreatedStart ( ) ) ) ; } if ( search . getDateCreatedEnd ( ) > 0 ) { m_dateCreatedEndDateBox . setValue ( new Date ( search . getDateCreatedEnd ( ) ) ) ; } if ( search . getDateModifiedStart ( ) > 0 ) { m_dateModifiedStartDateBox . setValue ( new Date ( search . getDateModifiedStart ( ) ) ) ; } if ( search . getDateModifiedEnd ( ) > 0 ) { m_dateModifiedEndDateBox . setValue ( new Date ( search . getDateModifiedEnd ( ) ) ) ; } if ( search . getScope ( ) != null ) { m_scopeSelection . setFormValue ( search . getScope ( ) . name ( ) ) ; } |
public class FoxHttpRequestBuilder { /** * Get the FoxHttpRequest of this builder
* @ return FoxHttpRequest */
public FoxHttpRequest build ( ) throws MalformedURLException , FoxHttpRequestException { } } | if ( this . url != null ) { foxHttpRequest . setUrl ( this . url ) ; } return foxHttpRequest ; |
public class Compiler { /** * Compile a variable reference .
* @ param opPos The current position in the m _ opMap array .
* @ return reference to { @ link org . apache . xpath . operations . Variable } instance .
* @ throws TransformerException if a error occurs creating the Expression . */
protected Expression variable ( int opPos ) throws TransformerException { } } | Variable var = new Variable ( ) ; opPos = getFirstChildPos ( opPos ) ; int nsPos = getOp ( opPos ) ; java . lang . String namespace = ( OpCodes . EMPTY == nsPos ) ? null : ( java . lang . String ) getTokenQueue ( ) . elementAt ( nsPos ) ; java . lang . String localname = ( java . lang . String ) getTokenQueue ( ) . elementAt ( getOp ( opPos + 1 ) ) ; QName qname = new QName ( namespace , localname ) ; var . setQName ( qname ) ; return var ; |
public class Options { /** * Returns the value of an option as an integer , or - 1 if not defined . */
public static int intValue ( String option ) { } } | String s = value ( option ) ; if ( s != null ) { try { int val = Integer . parseInt ( s ) ; if ( val > 0 ) return ( val ) ; } catch ( NumberFormatException e ) { } } return ( - 1 ) ; |
public class FluoWait { /** * Wait until a scan of the table completes without seeing notifications AND without the Oracle
* issuing any timestamps during the scan . */
private static void waitUntilFinished ( FluoConfiguration config ) { } } | try ( Environment env = new Environment ( config ) ) { List < TableRange > ranges = getRanges ( env ) ; outer : while ( true ) { long ts1 = env . getSharedResources ( ) . getOracleClient ( ) . getStamp ( ) . getTxTimestamp ( ) ; for ( TableRange range : ranges ) { boolean sawNotifications = waitTillNoNotifications ( env , range ) ; if ( sawNotifications ) { ranges = getRanges ( env ) ; // This range had notifications . Processing those notifications may have created
// notifications in previously scanned ranges , so start over .
continue outer ; } } long ts2 = env . getSharedResources ( ) . getOracleClient ( ) . getStamp ( ) . getTxTimestamp ( ) ; // Check to ensure the Oracle issued no timestamps during the scan for notifications .
if ( ts2 - ts1 == 1 ) { break ; } } } catch ( Exception e ) { log . error ( "An exception was thrown -" , e ) ; System . exit ( - 1 ) ; } |
public class AWSCodeCommitClient { /** * Returns information about comments made on the comparison between two commits .
* @ param getCommentsForComparedCommitRequest
* @ return Result of the GetCommentsForComparedCommit operation returned by the service .
* @ throws RepositoryNameRequiredException
* A repository name is required but was not specified .
* @ throws RepositoryDoesNotExistException
* The specified repository does not exist .
* @ throws InvalidRepositoryNameException
* At least one specified repository name is not valid . < / p > < note >
* This exception only occurs when a specified repository name is not valid . Other exceptions occur when a
* required repository parameter is missing , or when a specified repository does not exist .
* @ throws CommitIdRequiredException
* A commit ID was not specified .
* @ throws InvalidCommitIdException
* The specified commit ID is not valid .
* @ throws CommitDoesNotExistException
* The specified commit does not exist or no commit was specified , and the specified repository has no
* default branch .
* @ throws InvalidMaxResultsException
* The specified number of maximum results is not valid .
* @ throws InvalidContinuationTokenException
* The specified continuation token is not valid .
* @ throws EncryptionIntegrityChecksFailedException
* An encryption integrity check failed .
* @ throws EncryptionKeyAccessDeniedException
* An encryption key could not be accessed .
* @ throws EncryptionKeyDisabledException
* The encryption key is disabled .
* @ throws EncryptionKeyNotFoundException
* No encryption key was found .
* @ throws EncryptionKeyUnavailableException
* The encryption key is not available .
* @ sample AWSCodeCommit . GetCommentsForComparedCommit
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / codecommit - 2015-04-13 / GetCommentsForComparedCommit "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public GetCommentsForComparedCommitResult getCommentsForComparedCommit ( GetCommentsForComparedCommitRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeGetCommentsForComparedCommit ( request ) ; |
public class Encoding { /** * Encodes a byte array to a Base64 encoded String .
* < br / > ( cf . RFC 1341 section 5.2)
* This implementation heavily outperforms sun . misc . BASE64Encoder , which is
* not " officially " available anyway ( about four times faster on 1.3 and
* about double speed on 1.4 ) .
* @ param code the byte code to be encoded
* @ return the Base64 encoded String representing the plain bytecode */
public static String base64encode ( byte [ ] code ) { } } | if ( null == code ) return null ; if ( 0 == code . length ) return new String ( ) ; int len = code . length ; // remainder of the encoding process
int rem = len % 3 ; // size of the destination byte array
byte [ ] dst = new byte [ 4 + ( ( ( len - 1 ) / 3 ) << 2 ) + ( len / 57 ) ] ; // actual column of the destination string ;
// RFC 1341 requires a linefeed every 58 data bytes
int column = 0 ; // position within source
int spos = 0 ; // position within destination
int dpos = 0 ; // adjust length for loop ( remainder is treated separately )
len -= 2 ; // using a while loop here since spos may be needed for the remainder
while ( spos < len ) { byte b0 = code [ spos ] ; byte b1 = code [ spos + 1 ] ; byte b2 = code [ spos + 2 ] ; dst [ dpos ++ ] = _base64en [ 0x3f & ( b0 >>> 2 ) ] ; dst [ dpos ++ ] = _base64en [ ( 0x30 & ( b0 << 4 ) ) + ( 0x0f & ( b1 >>> 4 ) ) ] ; dst [ dpos ++ ] = _base64en [ ( 0x3c & ( b1 << 2 ) ) + ( 0x03 & ( b2 >>> 6 ) ) ] ; dst [ dpos ++ ] = _base64en [ 0x3f & b2 ] ; spos += 3 ; column += 3 ; if ( 57 == column ) { dst [ dpos ++ ] = 10 ; column = 0 ; } } // there may be a remainder to be processed
if ( 0 != rem ) { byte b0 = code [ spos ] ; dst [ dpos ++ ] = _base64en [ 0x3f & ( b0 >>> 2 ) ] ; if ( 1 == rem ) { // one - byte remainder
dst [ dpos ++ ] = _base64en [ 0x30 & ( b0 << 4 ) ] ; dst [ dpos ++ ] = 61 ; } else { // two - byte remainder
byte b1 = code [ spos + 1 ] ; dst [ dpos ++ ] = _base64en [ ( 0x30 & ( b0 << 4 ) ) + ( 0x0f & ( b1 >>> 4 ) ) ] ; dst [ dpos ++ ] = _base64en [ 0x3c & ( b1 << 2 ) ] ; } dst [ dpos ++ ] = 61 ; } // using any default encoding is possible , since the base64 char subset is
// identically represented in all ISO encodings , including US - ASCII
return new String ( dst ) ; |
public class AbstractBaseController { /** * Build an event handler by reflection to wrap the event adapter given .
* @ param eventAdapter the instance of an eventAdapter
* @ param adapterClass the adapter class used by the handler constructor
* @ param handlerClass the handler class to build
* @ return the required event handler
* @ param < E > the Event type to manage
* @ throws CoreException if an error occurred while creating the event handler */
private < E extends Event > EventHandler < E > wrapbuildHandler ( final EventAdapter eventAdapter , final Class < ? extends EventAdapter > adapterClass , final Class < ? extends EventHandler < E > > handlerClass ) throws CoreException { } } | try { return handlerClass . getDeclaredConstructor ( adapterClass ) . newInstance ( eventAdapter ) ; } catch ( InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e ) { throw new CoreException ( "Impossible to build event handler " + handlerClass . getName ( ) + " for the class " + this . getClass ( ) . getName ( ) , e ) ; } |
public class WebContainerListener { /** * { @ inheritDoc } */
@ Override public ClassLoader getClassLoader ( ComponentMetaData metaData ) { } } | ModuleMetaData moduleMetaData = ( metaData != null ) ? metaData . getModuleMetaData ( ) : null ; if ( moduleMetaData instanceof WebModuleMetaData ) { WebAppConfiguration webAppConfiguration = ( WebAppConfiguration ) ( ( WebModuleMetaData ) moduleMetaData ) . getConfiguration ( ) ; return webAppConfiguration . getWebApp ( ) . getClassLoader ( ) ; } else { return null ; } |
public class SoyFileSet { /** * Performs the parsing and extraction logic . */
private SoyMsgBundle doExtractMsgs ( ) { } } | // extractMsgs disables a bunch of passes since it is typically not configured with things
// like global definitions , type definitions , plugins , etc .
SoyFileSetNode soyTree = parse ( passManagerBuilder ( ) . allowUnknownGlobals ( ) . allowV1Expression ( ) . setTypeRegistry ( SoyTypeRegistry . DEFAULT_UNKNOWN ) // TODO ( lukes ) : consider changing this to pass a null resolver instead of the
// ALLOW _ UNDEFINED mode
. setPluginResolver ( new PluginResolver ( PluginResolver . Mode . ALLOW_UNDEFINED , printDirectives , soyFunctionMap , soySourceFunctionMap , errorReporter ) ) . disableAllTypeChecking ( ) , // override the type registry so that the parser doesn ' t report errors when it
// can ' t resolve strict types
SoyTypeRegistry . DEFAULT_UNKNOWN ) . fileSet ( ) ; throwIfErrorsPresent ( ) ; SoyMsgBundle bundle = new ExtractMsgsVisitor ( ) . exec ( soyTree ) ; throwIfErrorsPresent ( ) ; return bundle ; |
public class MtasDataCollector { /** * Inits the new list basic .
* @ param maxNumberOfTerms the max number of terms
* @ throws IOException Signals that an I / O exception has occurred . */
@ SuppressWarnings ( "unchecked" ) private void initNewListBasic ( int maxNumberOfTerms ) throws IOException { } } | if ( ! closed ) { position = 0 ; newPosition = 0 ; newCurrentPosition = 0 ; newSize = maxNumberOfTerms + size ; newKeyList = new String [ newSize ] ; newSourceNumberList = new int [ newSize ] ; newErrorNumber = new int [ newSize ] ; newErrorList = ( HashMap < String , Integer > [ ] ) new HashMap < ? , ? > [ newSize ] ; newKnownKeyFoundInSegment = new HashSet < > ( ) ; if ( hasSub ) { newSubCollectorListNextLevel = new MtasDataCollector [ newSize ] ; } } else { throw new IOException ( "already closed" ) ; } |
public class ListSecretVersionIdsResult { /** * The list of the currently available versions of the specified secret .
* @ param versions
* The list of the currently available versions of the specified secret . */
public void setVersions ( java . util . Collection < SecretVersionsListEntry > versions ) { } } | if ( versions == null ) { this . versions = null ; return ; } this . versions = new java . util . ArrayList < SecretVersionsListEntry > ( versions ) ; |
public class CSVSparkTransform { /** * Runs the transform process
* @ param batch the record to transform
* @ return the transformed record */
public BatchCSVRecord transform ( BatchCSVRecord batch ) { } } | BatchCSVRecord batchCSVRecord = new BatchCSVRecord ( ) ; List < List < Writable > > converted = execute ( toArrowWritables ( toArrowColumnsString ( bufferAllocator , transformProcess . getInitialSchema ( ) , batch . getRecordsAsString ( ) ) , transformProcess . getInitialSchema ( ) ) , transformProcess ) ; int numCols = converted . get ( 0 ) . size ( ) ; for ( int row = 0 ; row < converted . size ( ) ; row ++ ) { String [ ] values = new String [ numCols ] ; for ( int i = 0 ; i < values . length ; i ++ ) values [ i ] = converted . get ( row ) . get ( i ) . toString ( ) ; batchCSVRecord . add ( new SingleCSVRecord ( values ) ) ; } return batchCSVRecord ; |
public class Table { /** * Set the style of a column .
* @ param col The column number
* @ param ts The style to be used , make sure the style is of type
* TableFamilyStyle . STYLEFAMILY _ TABLECOLUMN
* @ throws FastOdsException Thrown if col has an invalid value . */
public void setColumnStyle ( final int col , final TableColumnStyle ts ) throws FastOdsException { } } | if ( this . appender . isPreambleWritten ( ) ) throw new IllegalStateException ( ) ; this . builder . setColumnStyle ( col , ts ) ; |
public class VideoPositionTarget { /** * Sets the videoPositionWithinPod value for this VideoPositionTarget .
* @ param videoPositionWithinPod * The video position within a pod to target . To target a video
* position or a bumper position ,
* this value must be null . To target a position within
* a pod this value must be populated . To
* target a custom ad spot , this value must be null . */
public void setVideoPositionWithinPod ( com . google . api . ads . admanager . axis . v201811 . VideoPositionWithinPod videoPositionWithinPod ) { } } | this . videoPositionWithinPod = videoPositionWithinPod ; |
public class ObjectMap { /** * Returns the value associated with the key , or null . */
public V remove ( K key ) { } } | int hashCode = key . hashCode ( ) ; int index = hashCode & mask ; if ( key . equals ( keyTable [ index ] ) ) { keyTable [ index ] = null ; V oldValue = valueTable [ index ] ; valueTable [ index ] = null ; size -- ; return oldValue ; } index = hash2 ( hashCode ) ; if ( key . equals ( keyTable [ index ] ) ) { keyTable [ index ] = null ; V oldValue = valueTable [ index ] ; valueTable [ index ] = null ; size -- ; return oldValue ; } index = hash3 ( hashCode ) ; if ( key . equals ( keyTable [ index ] ) ) { keyTable [ index ] = null ; V oldValue = valueTable [ index ] ; valueTable [ index ] = null ; size -- ; return oldValue ; } if ( bigTable ) { index = hash4 ( hashCode ) ; if ( key . equals ( keyTable [ index ] ) ) { keyTable [ index ] = null ; V oldValue = valueTable [ index ] ; valueTable [ index ] = null ; size -- ; return oldValue ; } } return removeStash ( key ) ; |
public class FactoryInterpolation { /** * Pixel based interpolation on multi - band image
* @ param min Minimum possible pixel value . Inclusive .
* @ param max Maximum possible pixel value . Inclusive .
* @ param type Interpolation type
* @ param imageType Type of input image */
public static < T extends ImageBase < T > > InterpolatePixelMB < T > createPixelMB ( double min , double max , InterpolationType type , BorderType borderType , ImageType < T > imageType ) { } } | switch ( imageType . getFamily ( ) ) { case PLANAR : return ( InterpolatePixelMB < T > ) createPixelPL ( ( InterpolatePixelS ) createPixelS ( min , max , type , borderType , imageType . getDataType ( ) ) ) ; case GRAY : { InterpolatePixelS interpS = createPixelS ( min , max , type , borderType , imageType . getImageClass ( ) ) ; return new InterpolatePixel_S_to_MB ( interpS ) ; } case INTERLEAVED : switch ( type ) { case NEAREST_NEIGHBOR : return nearestNeighborPixelMB ( ( ImageType ) imageType , borderType ) ; case BILINEAR : return bilinearPixelMB ( ( ImageType ) imageType , borderType ) ; default : throw new IllegalArgumentException ( "Interpolate type not yet support for ImageInterleaved" ) ; } default : throw new IllegalArgumentException ( "Add type: " + type ) ; } |
public class SpanUniqueIdGenerator { /** * Reverse method to the { @ link SpanUniqueIdGenerator # toUnique ( Span ) } to generate original
* id from the unique id .
* @ param span Span with unique id .
* @ return Original id of the span . */
public static String toOriginal ( Span span ) { } } | String id = span . getId ( ) ; if ( span . clientSpan ( ) ) { int suffixIndex = id . lastIndexOf ( CLIENT_ID_SUFFIX ) ; if ( suffixIndex > 0 ) { id = id . substring ( 0 , suffixIndex ) ; } } return id ; |
public class DefaultTraceCollector { /** * This method merges an inner Producer node information into its
* containing Producer node , before removing the inner node .
* @ param inner
* @ param outer */
protected void mergeProducer ( Producer inner , Producer outer ) { } } | if ( log . isLoggable ( Level . FINEST ) ) { log . finest ( "Merging Producer = " + inner + " into Producer = " + outer ) ; } // NOTE : For now , assumption is that inner Producer is equivalent to the outer
// and results from instrumentation rules being triggered multiple times
// for the same message .
// Merge correlation - just replace for now
if ( log . isLoggable ( Level . FINEST ) ) { log . finest ( "Merging Producers: replacing correlation ids (" + outer . getCorrelationIds ( ) + ") with (" + inner . getCorrelationIds ( ) + ")" ) ; } outer . setCorrelationIds ( inner . getCorrelationIds ( ) ) ; // Remove the inner Producer from the child nodes of the outer
outer . getNodes ( ) . remove ( inner ) ; |
public class RDBMetadata { /** * creates a view for SQLQueryParser
* ( NOTE : these views are simply names for complex non - parsable subqueries , not database views )
* TODO : make the second argument a callback ( which is called only when needed )
* TODO : make it re - use parser views for the same SQL
* @ param sql
* @ return */
public ParserViewDefinition createParserView ( String sql , ImmutableList < QuotedID > attributes ) { } } | if ( ! isStillMutable ( ) ) { throw new IllegalStateException ( "Too late! Parser views must be created before freezing the DBMetadata" ) ; } RelationID id = getQuotedIDFactory ( ) . createRelationID ( null , String . format ( "view_%s" , parserViewCounter ++ ) ) ; ParserViewDefinition view = new ParserViewDefinition ( id , attributes , sql , typeFactory . getXsdStringDatatype ( ) ) ; // UGLY ! !
add ( view , relations ) ; return view ; |
public class AJAXBroadcastComponent { /** * Execute the ajax call when ajax syntax was found ajax : < command >
* @ param context
* @ param command
* @ return */
private Object executeAjaxCalls ( FacesContext context , String command ) { } } | Object result = null ; int pos = command . indexOf ( "ajax:" ) ; while ( pos >= 0 ) { // the command may contain several AJAX and
// JavaScript calls , in arbitrary order
String el = command . substring ( pos + "ajax:" . length ( ) ) ; if ( el . contains ( "javascript:" ) ) { int end = el . indexOf ( "javascript:" ) ; el = el . substring ( 0 , end ) ; } el = el . trim ( ) ; while ( el . endsWith ( ";" ) ) { el = el . substring ( 0 , el . length ( ) - 1 ) . trim ( ) ; } if ( context . isProjectStage ( ProjectStage . Development ) ) { checkELSyntax ( el , context . getELContext ( ) ) ; } ValueExpression vex = evalAsValueExpression ( "#{" + el + "}" ) ; try { result = vex . getValue ( context . getELContext ( ) ) ; } catch ( javax . el . PropertyNotFoundException ex ) { MethodExpression mex = evalAsMethodExpression ( "#{" + el + "}" ) ; result = mex . invoke ( context . getELContext ( ) , null ) ; } // look for the next AJAX call ( if any )
pos = command . indexOf ( "ajax:" , pos + 1 ) ; } return result ; |
public class ImmutableRoaringBitmap { /** * Cardinality of the bitwise XOR ( symmetric difference ) operation .
* The provided bitmaps are * not * modified . This operation is thread - safe
* as long as the provided bitmaps remain unchanged .
* @ param x1 first bitmap
* @ param x2 other bitmap
* @ return cardinality of the symmetric difference */
public static int xorCardinality ( final ImmutableRoaringBitmap x1 , final ImmutableRoaringBitmap x2 ) { } } | return x1 . getCardinality ( ) + x2 . getCardinality ( ) - 2 * andCardinality ( x1 , x2 ) ; |
public class ByteBuddy { /** * Rebases a package . This offers an opportunity to add annotations to the package definition . Packages are defined
* by classes named { @ code package - info } without any methods or fields but permit annotations . Any field or method
* definition will cause an { @ link IllegalStateException } to be thrown when the type is created .
* @ param aPackage The package that is being rebased .
* @ param classFileLocator The class file locator to use for locating the package ' s class file .
* @ return A type builder for rebasing the given package . */
public DynamicType . Builder < ? > rebase ( Package aPackage , ClassFileLocator classFileLocator ) { } } | return rebase ( new PackageDescription . ForLoadedPackage ( aPackage ) , classFileLocator ) ; |
public class DbConfiguration { /** * Provides a list of all connection wrappers corresponding to a given environment .
* @ param env name of environment , such as " development " , " production " , etc .
* @ return a list of all connection wrappers corresponding to a given environment . */
public static List < ConnectionSpecWrapper > getConnectionSpecWrappers ( String env ) { } } | return connectionWrappers . get ( env ) == null ? new ArrayList < > ( ) : connectionWrappers . get ( env ) ; |
public class SimpleObserver { /** * Register this observer with the JCR event listeners
* @ throws RepositoryException if repository exception occurred */
@ PostConstruct public void buildListener ( ) throws RepositoryException { } } | LOGGER . debug ( "Constructing an observer for JCR events..." ) ; session = getJcrSession ( repository . login ( ) ) ; session . getWorkspace ( ) . getObservationManager ( ) . addEventListener ( this , EVENT_TYPES , "/" , true , null , null , false ) ; session . save ( ) ; |
public class AfplibFactoryImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public FNCPatTech createFNCPatTechFromString ( EDataType eDataType , String initialValue ) { } } | FNCPatTech result = FNCPatTech . get ( initialValue ) ; if ( result == null ) throw new IllegalArgumentException ( "The value '" + initialValue + "' is not a valid enumerator of '" + eDataType . getName ( ) + "'" ) ; return result ; |
public class FileUtils { /** * Return file from context . getFilesDir ( ) / fileName
* @ param context application context
* @ param fileName path to the file
* @ return instance of the file object . */
@ NonNull public static File getFile ( @ NonNull Context context , @ NonNull String fileName ) { } } | return new File ( context . getFilesDir ( ) , fileName ) ; |
public class StringUtilities { /** * Returns the given byte array after if it has been encoded .
* @ param bytes The byte array to be encoded
* @ return The encoded string */
public static String encodeBytes ( byte [ ] bytes ) { } } | String ret = null ; try { // Obfuscate the string
if ( bytes != null ) ret = new String ( Base64 . encodeBase64 ( bytes ) ) ; } catch ( NoClassDefFoundError e ) { ret = new String ( bytes ) ; System . out . println ( "WARNING: unable to encode: " + e . getClass ( ) . getName ( ) + ": " + e . getMessage ( ) ) ; } return ret ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.