signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class Misc { /** * Returns the URL for file on the classpath as a String */
public static String getResourceURL ( String resource ) { } } | ClassLoader cl = Thread . currentThread ( ) . getContextClassLoader ( ) ; return cl . getResource ( resource ) . toString ( ) ; |
public class druidGLexer { /** * $ ANTLR start " DROP " */
public final void mDROP ( ) throws RecognitionException { } } | try { int _type = DROP ; int _channel = DEFAULT_TOKEN_CHANNEL ; // druidG . g : 594:17 : ( ( ' DROP ' | ' drop ' ) )
// druidG . g : 594:18 : ( ' DROP ' | ' drop ' )
{ // druidG . g : 594:18 : ( ' DROP ' | ' drop ' )
int alt10 = 2 ; int LA10_0 = input . LA ( 1 ) ; if ( ( LA10_0 == 'D' ) ) { alt10 = 1 ; } else if ( ( LA... |
public class QueryCountLoggerBuilder { /** * Build { @ link net . ttddyy . dsproxy . support . SLF4JQueryCountLoggingServletFilter } .
* @ param logLevel slf4j log level
* @ return query - count - logger using slf4j */
public SLF4JQueryCountLoggingServletFilter buildSlf4jFilter ( SLF4JLogLevel logLevel ) { } } | if ( logLevel != null ) { this . slf4jLogLevel = logLevel ; } SLF4JQueryCountLoggingServletFilter filter = new SLF4JQueryCountLoggingServletFilter ( ) ; if ( this . slf4jLogLevel != null ) { filter . setLogLevel ( this . slf4jLogLevel ) ; } filter . setWriteAsJson ( this . writeAsJson ) ; return filter ; |
public class vpntrafficaction { /** * Use this API to fetch vpntrafficaction resource of given name . */
public static vpntrafficaction get ( nitro_service service , String name ) throws Exception { } } | vpntrafficaction obj = new vpntrafficaction ( ) ; obj . set_name ( name ) ; vpntrafficaction response = ( vpntrafficaction ) obj . get_resource ( service ) ; return response ; |
public class JSONObject { /** * Appends values to the array mapped to { @ code name } . A new { @ link JSONArray }
* mapping for { @ code name } will be inserted if no mapping exists . If the existing
* mapping for { @ code name } is not a { @ link JSONArray } , a { @ link JSONException }
* will be thrown .
* @... | Object current = nameValuePairs . get ( checkName ( name ) ) ; final JSONArray array ; if ( current instanceof JSONArray ) { array = ( JSONArray ) current ; } else if ( current == null ) { JSONArray newArray = new JSONArray ( ) ; nameValuePairs . put ( name , newArray ) ; array = newArray ; } else { throw new JSONExcep... |
public class VirtualCdj { /** * Send a device update to all registered update listeners .
* @ param update the device update that has just arrived */
private void deliverDeviceUpdate ( final DeviceUpdate update ) { } } | for ( DeviceUpdateListener listener : getUpdateListeners ( ) ) { try { listener . received ( update ) ; } catch ( Throwable t ) { logger . warn ( "Problem delivering device update to listener" , t ) ; } } |
public class TCAPProviderImpl { /** * get next Seq Control value available */
protected int getNextSeqControl ( ) { } } | int res = seqControl . getAndIncrement ( ) ; // if ( ! seqControl . compareAndSet ( 256 , 1 ) ) {
// return seqControl . getAndIncrement ( ) ;
// } else {
// return 0;
// seqControl + + ;
// if ( seqControl > 255 ) {
// seqControl = 0;
// return seqControl ;
if ( this . stack . getSlsRangeType ( ) == SlsRangeType . Odd... |
public class Era { /** * 指定した日時に該当する期間情報を取得する 。
* @ param date 判定対象の日時 。 タイムゾーンは 、 { @ literal GMT - 00:00 } である必要がある 。
* @ return 見つからない場合は 、 存在しない期間を示すクラス { @ link EraPeriod # UNKNOWN _ PERIOD } のインスタンスを返す 。
* @ throws IllegalArgumentException { @ literal date = = null . } */
public EraPeriod getTargetPeriod... | ArgUtils . notNull ( date , "date" ) ; for ( EraPeriod period : periods ) { if ( period . contains ( date ) ) { return period ; } } return EraPeriod . UNKNOWN_PERIOD ; |
public class A_CmsListResourceCollector { /** * Returns the state of the parameter map . < p >
* @ param params the parameter map
* @ return the state of the list from the parameter map */
protected CmsListState getState ( Map < String , String > params ) { } } | CmsListState state = new CmsListState ( ) ; try { state . setPage ( Integer . parseInt ( params . get ( I_CmsListResourceCollector . PARAM_PAGE ) ) ) ; } catch ( Throwable e ) { // ignore
} try { state . setOrder ( CmsListOrderEnum . valueOf ( params . get ( I_CmsListResourceCollector . PARAM_ORDER ) ) ) ; } catch ( Th... |
public class BeanContextServicesSupport { /** * The implementation goes through following steps :
* < ol >
* < li > Calls < code > defaultReadObject ( ) < / code > . < / li >
* < li > Reads serializable service listeners . < / li >
* < / ol >
* @ param ois
* the object input stream
* @ throws IOException ... | ois . defaultReadObject ( ) ; deserialize ( ois , bcsListeners ) ; |
public class PackratParser { /** * After finding a recursion or a seed grow in process , this method puts all
* information in place for seed grow . This might be the start information for
* the growth or the current result in the growing , which means the current
* result .
* @ param production
* @ param l
... | /* * If the lr object does not contain a head , we found a new recursion
* production . Otherwise we already know the production , but we found another
* production which is involved in the recursion . */
if ( l . getHead ( ) == null ) l . setHead ( new Head ( production ) ) ; /* * Go over all heads and . . . ! ? *... |
public class Locale { /** * Returns a three - letter abbreviation of this locale ' s language .
* If the language matches an ISO 639-1 two - letter code , the
* corresponding ISO 639-2 / T three - letter lowercase code is
* returned . The ISO 639-2 language codes can be found on - line ,
* see " Codes for the R... | // Android - changed : Use ICU . getIso3Language . Also return " " for empty languages
// for the sake of backwards compatibility .
String lang = baseLocale . getLanguage ( ) ; if ( lang . length ( ) == 3 ) { return lang ; } else if ( lang . isEmpty ( ) ) { return "" ; } String language3 = ICU . getISO3Language ( lang ... |
public class ListTaskExecutionsResult { /** * A list of executed tasks .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setTaskExecutions ( java . util . Collection ) } or { @ link # withTaskExecutions ( java . util . Collection ) } if you want
* to overri... | if ( this . taskExecutions == null ) { setTaskExecutions ( new java . util . ArrayList < TaskExecutionListEntry > ( taskExecutions . length ) ) ; } for ( TaskExecutionListEntry ele : taskExecutions ) { this . taskExecutions . add ( ele ) ; } return this ; |
public class DeviceList { /** * Start device discover with the BluetoothAdapter */
private void doDiscovery ( ) { } } | if ( D ) Log . d ( TAG , "doDiscovery()" ) ; // Remove all element from the list
mPairedDevicesArrayAdapter . clear ( ) ; // If there are paired devices , add each one to the ArrayAdapter
if ( pairedDevices . size ( ) > 0 ) { for ( BluetoothDevice device : pairedDevices ) { mPairedDevicesArrayAdapter . add ( device . g... |
public class CmsShellCommands { /** * Returns the owner of a project . < p >
* @ param project the id of the project
* @ return the owner of the project
* @ throws Exception if something goes wrong */
public CmsUser readOwnerOfProject ( CmsUUID project ) throws Exception { } } | return m_cms . readOwner ( m_cms . readProject ( project ) ) ; |
public class SpatialJoinUtils { /** * Returns a subset of conjuncts matching one of the following shapes :
* - ST _ Contains ( . . . )
* - ST _ Within ( . . . )
* - ST _ Intersects ( . . . )
* Doesn ' t check or guarantee anything about function arguments . */
public static List < FunctionCall > extractSupporte... | return extractConjuncts ( filterExpression ) . stream ( ) . filter ( FunctionCall . class :: isInstance ) . map ( FunctionCall . class :: cast ) . filter ( SpatialJoinUtils :: isSupportedSpatialFunction ) . collect ( toImmutableList ( ) ) ; |
public class AbcGrammar { /** * grace notes can have length
* grace - notes : : = " { " acciaccatura 1 * ( grace - note - stem ) " } " */
Rule GraceNotes ( ) { } } | return Sequence ( String ( "{" ) , OptionalS ( Acciaccatura ( ) ) , ZeroOrMoreS ( GraceNoteStem ( ) ) , String ( "}" ) ) . label ( GraceNotes ) ; |
public class FileSystemUtilities { /** * Filters files found either in the sources paths ( or in the standardDirectory if no explicit sources are given ) ,
* and retrieves a List holding those files that do not match any of the supplied Java Regular Expression
* excludePatterns .
* @ param baseDir The non - null ... | // Check sanity
Validate . notNull ( baseDir , "baseDir" ) ; Validate . notNull ( log , "log" ) ; Validate . notEmpty ( standardDirectory , "standardDirectory" ) ; Validate . notEmpty ( fileTypeDescription , "fileTypeDescription" ) ; // No sources provided ? Fallback to the standard ( which should be a relative path ) ... |
public class ArrayMath { /** * OPERATIONS ON AN ARRAY - NONDESTRUCTIVE */
public static double [ ] exp ( double [ ] a ) { } } | double [ ] result = new double [ a . length ] ; for ( int i = 0 ; i < a . length ; i ++ ) { result [ i ] = Math . exp ( a [ i ] ) ; } return result ; |
public class BasicStreamReader { /** * Method that will skip any white space from input source ( s )
* @ return true If at least one white space was skipped ; false
* if not ( character passed was not white space ) */
protected final boolean skipWS ( char c ) throws XMLStreamException { } } | if ( c > CHAR_SPACE ) { return false ; } while ( true ) { // Linefeed ?
if ( c == '\n' || c == '\r' ) { skipCRLF ( c ) ; } else if ( c != CHAR_SPACE && c != '\t' ) { throwInvalidSpace ( c ) ; } if ( mInputPtr >= mInputEnd ) { // Let ' s see if current source has more
if ( ! loadMoreFromCurrent ( ) ) { return true ; } }... |
public class AWSBatchClient { /** * Cancels a job in an AWS Batch job queue . Jobs that are in the < code > SUBMITTED < / code > , < code > PENDING < / code > , or
* < code > RUNNABLE < / code > state are cancelled . Jobs that have progressed to < code > STARTING < / code > or
* < code > RUNNING < / code > are not ... | request = beforeClientExecution ( request ) ; return executeCancelJob ( request ) ; |
public class MetricsManager { /** * Get MetricsLogger to start collecting metrics . MetricsLogger can be used to collect Counter , Timer or Recorder
* @ param dimensions , key - value pairs aka dimensions for example " api = Upload , region = DUB "
* @ return metrics logger */
public static MetricsLogger getMetrics... | if ( MetricsManager . instance != null ) { final Map < String , String > dimensionsMap = DimensionsUtils . parseDimensions ( dimensions ) ; if ( ! dimensionsMap . isEmpty ( ) ) { dimensionsMap . put ( "service" , MetricsManager . instance . serviceName ) ; if ( MetricsManager . instance . env . length ( ) > 0 ) { dimen... |
public class CmsScrollPanel { /** * Sets the start parameters of the resize event . < p >
* @ param event the mouse event */
protected void setStartParameters ( MouseDownEvent event ) { } } | m_oldheight = Double . parseDouble ( getElement ( ) . getStyle ( ) . getHeight ( ) . replace ( "px" , "" ) ) ; m_clientY = event . getClientY ( ) ; |
public class KeyInfo { /** * { @ inheritDoc } */
@ Override public int compareTo ( final KeyInfo other ) { } } | int retVal = 1 ; if ( other != null ) { if ( this . name != null && other . name != null ) { retVal = this . name . compareTo ( other . name ) ; } else if ( this . name == null ) { retVal = ( other . name == null ) ? 0 : - 1 ; } } return retVal ; |
public class CQLSSTableWriter { /** * Adds a new row to the writer .
* This is a shortcut for { @ code addRow ( Arrays . asList ( values ) ) } .
* @ param values the row values ( corresponding to the bind variables of the
* insertion statement used when creating by this writer ) .
* @ return this writer . */
pu... | return addRow ( Arrays . asList ( values ) ) ; |
public class ClobStreamingProcess { /** * { @ inheritDoc } */
@ Override public long length ( Clob entity ) throws IOException { } } | try { return entity . length ( ) ; } catch ( SQLException e ) { throw new IOException ( e ) ; } |
public class Logic { /** * Negates the given predicate .
* @ param < T > the element type parameter
* @ param predicate the predicate to be negated
* @ return the negated predicate */
public static < T > Predicate < T > not ( Predicate < T > predicate ) { } } | dbc . precondition ( predicate != null , "cannot negate a null predicate" ) ; return predicate . negate ( ) ; |
public class Annotate { /** * Tokenizes and segments input text . Outputs tokenized text in conll format :
* one token per sentence and two newlines to divide sentences plus offsets
* and lenght information about tokens .
* @ return String tokenized text */
public String tokenizeToCoNLLOffsets ( ) { } } | final StringBuilder sb = new StringBuilder ( ) ; final String [ ] sentences = segmenter . segmentSentence ( ) ; final List < List < Token > > tokens = tokenizer . tokenize ( sentences ) ; for ( final List < Token > tokSentence : tokens ) { for ( final Token token : tokSentence ) { String tokenValue = token . getTokenVa... |
public class JDBCResultSet { /** * < ! - - start generic documentation - - >
* ( JDBC4 clarification : )
* Updates the designated column with a binary stream value , which will have
* the specified number of bytes .
* The updater methods are used to update column values in the
* current row or the insert row ... | startUpdate ( columnIndex ) ; preparedStatement . setBinaryStream ( columnIndex , x , length ) ; |
public class Cipher { /** * Tries to find the correct { @ code Cipher } transform to use . Returns a
* { @ link org . apache . harmony . security . fortress . Engine . SpiAndProvider } , throws the first exception that was
* encountered during attempted initialization , or { @ code null } if there are
* no provid... | // Enumerate all the transforms we need to try
ArrayList < Transform > transforms = new ArrayList < Transform > ( ) ; if ( tokenizedTransformation [ 1 ] != null && tokenizedTransformation [ 2 ] != null ) { transforms . add ( new Transform ( tokenizedTransformation [ 0 ] + "/" + tokenizedTransformation [ 1 ] + "/" + tok... |
public class DsParser { /** * Store recovery
* @ param r The recovery
* @ param writer The writer
* @ exception Exception Thrown if an error occurs */
@ Override protected void storeRecovery ( Recovery r , XMLStreamWriter writer ) throws Exception { } } | writer . writeStartElement ( XML . ELEMENT_RECOVERY ) ; if ( r . isNoRecovery ( ) != null ) writer . writeAttribute ( XML . ATTRIBUTE_NO_RECOVERY , r . getValue ( XML . ATTRIBUTE_NO_RECOVERY , r . isNoRecovery ( ) . toString ( ) ) ) ; if ( r . getCredential ( ) != null ) { writer . writeStartElement ( XML . ELEMENT_REC... |
public class Requests { /** * Create a { @ link SubscribeRequest } with a list of { @ link SubscribeElement }
* instances .
* @ param list the list of { @ link SubscribeElement } instances that are added
* to the new { @ link SubscribeRequest } . The { @ link SubscribeElement } instances
* are either { @ link S... | if ( list == null ) { throw new NullPointerException ( "list is not allowed to be null" ) ; } SubscribeRequest ret = createSubscribeReq ( ) ; for ( SubscribeElement el : list ) { ret . addSubscribeElement ( el ) ; } return ret ; |
public class InjectorBuilder { /** * Call the provided visitor for all elements of the current module .
* This call will not modify any bindings
* @ param visitor */
public < T > InjectorBuilder forEachElement ( ElementVisitor < T > visitor ) { } } | Elements . getElements ( module ) . forEach ( element -> element . acceptVisitor ( visitor ) ) ; return this ; |
public class StyleUtils { /** * Set the feature row style ( icon or style ) into the marker options
* @ param markerOptions marker options
* @ param featureStyleExtension feature style extension
* @ param featureRow feature row
* @ param density display density : { @ link android . util . DisplayMetrics # densi... | FeatureStyle featureStyle = featureStyleExtension . getFeatureStyle ( featureRow ) ; return setFeatureStyle ( markerOptions , featureStyle , density , iconCache ) ; |
public class MetadataManager { /** * Reads a row data from storage ( cache supported ) .
* @ param rowKey
* @ return */
private String getRow ( String rowKey ) { } } | try { return cache . get ( rowKey ) ; } catch ( Exception e ) { if ( e . getCause ( ) instanceof RowNotFoundException ) { return null ; } throw new RuntimeException ( e ) ; } |
public class PrcHasSeSellerSave { /** * < p > Process entity request . < / p >
* @ param pReqVars additional request scoped parameters
* @ param pRequestData Request Data
* @ param pEntity Entity to process
* @ return Entity processed for farther process or null
* @ throws Exception - an exception */
@ Overri... | SeSeller ses = findSeSeller . find ( pReqVars , pRequestData . getUserName ( ) ) ; pEntity . setSeller ( ses ) ; if ( pEntity . getIsNew ( ) ) { this . srvOrm . insertEntity ( pReqVars , pEntity ) ; pEntity . setIsNew ( false ) ; } else { T entOld = this . srvOrm . retrieveEntity ( pReqVars , pEntity ) ; if ( ! entOld ... |
public class Revision { /** * Sets the timestamp information .
* The input is expected to be the wikipedia version of the timestamp as
* String ( YYYY - MM - DDThh - mm - ssZ ) . T and Z will be replaced with spaces .
* @ param timeStamp
* timestamp ( wikipedia version ) */
public void setTimeStamp ( final Stri... | String time = timeStamp . replace ( 'T' , ' ' ) ; time = time . replace ( 'Z' , ' ' ) ; this . timeStamp = Timestamp . valueOf ( time ) ; |
public class MessageFormat { /** * Returns the applied pattern string .
* @ return the pattern string
* @ throws IllegalStateException after custom Format objects have been set
* via setFormat ( ) or similar APIs */
public String toPattern ( ) { } } | // Return the original , applied pattern string , or else " " .
// Note : This does not take into account
// - changes from setFormat ( ) and similar methods , or
// - normalization of apostrophes and arguments , for example ,
// whether some date / time / number formatter was created via a pattern
// but is equivalent... |
public class ClassReader { /** * Read module _ flags . */
Set < ModuleFlags > readModuleFlags ( int flags ) { } } | Set < ModuleFlags > set = EnumSet . noneOf ( ModuleFlags . class ) ; for ( ModuleFlags f : ModuleFlags . values ( ) ) { if ( ( flags & f . value ) != 0 ) set . add ( f ) ; } return set ; |
public class ActiveMqQueue { /** * Get the { @ link Session } dedicated for sending messages .
* @ return
* @ throws JMSException */
protected Session getProducerSession ( ) throws JMSException { } } | if ( producerSession == null ) { synchronized ( this ) { if ( producerSession == null ) { producerSession = createSession ( Session . AUTO_ACKNOWLEDGE ) ; } } } return producerSession ; |
public class Options { /** * Put an boolean value for the given option name .
* @ param key
* the option name .
* @ param value
* the boolean value . */
public Options putBoolean ( String key , IModel < Boolean > value ) { } } | putOption ( key , new BooleanOption ( value ) ) ; return this ; |
public class ZaurusConnectionDialog { /** * Method declaration
* @ param owner
* @ param title */
public static Connection createConnection ( Frame owner , String title , Insets defInsets ) { } } | ZaurusConnectionDialog dialog = new ZaurusConnectionDialog ( owner , title ) ; dialog . create ( defInsets ) ; return dialog . mConnection ; |
public class AmazonApiGatewayClient { /** * Deletes an existing < a > VpcLink < / a > of a specified identifier .
* @ param deleteVpcLinkRequest
* Deletes an existing < a > VpcLink < / a > of a specified identifier .
* @ return Result of the DeleteVpcLink operation returned by the service .
* @ throws Unauthori... | request = beforeClientExecution ( request ) ; return executeDeleteVpcLink ( request ) ; |
public class UserHandlerImpl { /** * { @ inheritDoc } */
public boolean authenticate ( String username , String password ) throws Exception { } } | Session session = service . getStorageSession ( ) ; try { return authenticate ( session , username , password , null ) ; } finally { session . logout ( ) ; } |
public class TimeZone { /** * Returns a frozen ICU type TimeZone object given a time zone ID .
* @ param id the time zone ID
* @ param trySystem if true tries the system time zones first otherwise skip to the
* custom time zones .
* @ return the frozen ICU TimeZone or null if one could not be created . */
stati... | BasicTimeZone result = null ; if ( trySystem ) { result = ZoneMeta . getSystemTimeZone ( id ) ; } if ( result == null ) { result = ZoneMeta . getCustomTimeZone ( id ) ; } return result ; |
public class FiredRuleCounter { /** * Results */
public int getRuleNameFireCount ( String ruleName ) { } } | Integer fireCount = ruleNameToFireCountMap . get ( ruleName ) ; return fireCount == null ? 0 : fireCount ; |
public class OSGiConfigUtils { /** * Get the filter string which will extract < appProperties > elements for the given application
* @ param applicationPid The pid of the application in the config
* @ return A filter string to be used by the OSGi ConfigurationAdmin service */
public static String getApplicationProp... | String applicationConfigFilter = null ; StringBuilder applicationFilter = new StringBuilder ( 200 ) ; applicationFilter . append ( "(&" ) ; applicationFilter . append ( FilterUtils . createPropertyFilter ( CFG_SERVICE_FACTORY_PID , CFG_APP_PROPERTIES ) ) ; applicationFilter . append ( FilterUtils . createPropertyFilter... |
public class OptionalUtils { /** * Throws an { @ link IllegalArgumentException } if both passed { @ link Optional } s are present or neither is . */
public static void exactlyOnePresentOrIllegalArgument ( final Optional < ? > x , final Optional < ? > y , final String msg ) { } } | if ( x . isPresent ( ) == y . isPresent ( ) ) { throw new IllegalArgumentException ( msg ) ; } |
public class LolChat { /** * Get all your friends who are online .
* @ return A list of all your online Friends */
public List < Friend > getOnlineFriends ( ) { } } | return getFriends ( new Filter < Friend > ( ) { public boolean accept ( Friend friend ) { return friend . isOnline ( ) ; } } ) ; |
public class KinesisVideoStreamMarshaller { /** * Marshall the given parameter object . */
public void marshall ( KinesisVideoStream kinesisVideoStream , ProtocolMarshaller protocolMarshaller ) { } } | if ( kinesisVideoStream == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( kinesisVideoStream . getArn ( ) , ARN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( )... |
public class BoxLegalHoldPolicy { /** * Retrieves a list of Legal Hold Policies that belong to your Enterprise as an Iterable .
* @ param api api the API connection to be used by the resource .
* @ param policyName case insensitive prefix - match filter on Policy name .
* @ param limit the limit of retrieved entr... | QueryStringBuilder builder = new QueryStringBuilder ( ) ; if ( policyName != null ) { builder . appendParam ( "policy_name" , policyName ) ; } if ( fields . length > 0 ) { builder . appendParam ( "fields" , fields ) ; } return new BoxResourceIterable < BoxLegalHoldPolicy . Info > ( api , ALL_LEGAL_HOLD_URL_TEMPLATE . b... |
public class FoldableItemLayout { /** * Translation preserving middle line splitting . */
public void setRollingDistance ( float distance ) { } } | final float scaleY = scale * scaleFactor * scaleFactorY ; topPart . applyRollingDistance ( distance , scaleY ) ; bottomPart . applyRollingDistance ( distance , scaleY ) ; |
public class GenericUrl { /** * Returns the URI for the given encoded URL .
* < p > Any { @ link MalformedURLException } is wrapped in an { @ link IllegalArgumentException } .
* @ param encodedUrl encoded URL
* @ return URL */
private static URL parseURL ( String encodedUrl ) { } } | try { return new URL ( encodedUrl ) ; } catch ( MalformedURLException e ) { throw new IllegalArgumentException ( e ) ; } |
public class PersistUtils { /** * DBOpenHelper */
public static boolean executeStatements ( final SQLiteDatabase db , final ArrayList < String > statements ) throws Exception { } } | Callable < Boolean > task = new Callable < Boolean > ( ) { @ Override public Boolean call ( ) throws Exception { for ( String statement : statements ) { L . i ( statement ) ; db . execSQL ( statement ) ; } return Boolean . TRUE ; } } ; Boolean result = executeInTransaction ( db , task ) ; return ( result != null ) ; |
public class FraggleManager { /** * Processes the custom animations element , adding them as required
* @ param animation Animation object to process
* @ param ft Fragment transaction to add to the transition */
protected void processAnimations ( FragmentAnimation animation , FragmentTransaction ft ) { } } | if ( animation != null ) { if ( animation . isCompletedAnimation ( ) ) { ft . setCustomAnimations ( animation . getEnterAnim ( ) , animation . getExitAnim ( ) , animation . getPushInAnim ( ) , animation . getPopOutAnim ( ) ) ; } else { ft . setCustomAnimations ( animation . getEnterAnim ( ) , animation . getExitAnim ( ... |
public class SyncProcessEvent { /** * get worker heartbeat by workerId
* @ param conf conf
* @ param workerId worker id
* @ return WorkerHeartbeat */
public WorkerHeartbeat readWorkerHeartbeat ( Map conf , String workerId ) throws Exception { } } | try { LocalState ls = StormConfig . worker_state ( conf , workerId ) ; return ( WorkerHeartbeat ) ls . get ( Common . LS_WORKER_HEARTBEAT ) ; } catch ( Exception e ) { LOG . error ( "Failed to get heartbeat for worker:{}" , workerId , e ) ; return null ; } |
public class Image { /** * Draw this image at the specified location
* @ param x The x location to draw the image at
* @ param y The y location to draw the image at */
@ Override public void draw ( float x , float y ) { } } | init ( ) ; draw ( x , y , width , height ) ; |
public class QueuedKeyedResourcePool { /** * A safe wrapper to destroy the given resource request . */
protected void destroyRequest ( AsyncResourceRequest < V > resourceRequest ) { } } | if ( resourceRequest != null ) { try { // To hand control back to the owner of the
// AsyncResourceRequest , treat " destroy " as an exception since
// there is no resource to pass into useResource , and the
// timeout has not expired .
Exception e = new UnreachableStoreException ( "Client request was terminated while ... |
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link Boolean } { @ code > } */
@ XmlElementDecl ( namespace = "http://docs.oasis-open.org/ns/cmis/messaging/200908/" , name = "includePolicyIds" , scope = GetObject . class ) public JAXBElement < Boolean > createGetObjectIn... | return new JAXBElement < Boolean > ( _GetObjectOfLatestVersionIncludePolicyIds_QNAME , Boolean . class , GetObject . class , value ) ; |
public class MethodDescriptor { /** * Extract the fully qualified service name out of a fully qualified method name . May return
* { @ code null } if the input is malformed , but you cannot rely on it for the validity of the
* input .
* @ since 1.0.0 */
@ Nullable public static String extractFullServiceName ( Str... | int index = checkNotNull ( fullMethodName , "fullMethodName" ) . lastIndexOf ( '/' ) ; if ( index == - 1 ) { return null ; } return fullMethodName . substring ( 0 , index ) ; |
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EClass getIfcCoveringType ( ) { } } | if ( ifcCoveringTypeEClass == null ) { ifcCoveringTypeEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 126 ) ; } return ifcCoveringTypeEClass ; |
public class CmsObject { /** * Copies a resource . < p >
* The copied resource will always be locked to the current user
* after the copy operation . < p >
* The < code > siblingMode < / code > parameter controls how to handle siblings
* during the copy operation . < br >
* Possible values for this parameter ... | CmsResource resource = readResource ( source , CmsResourceFilter . IGNORE_EXPIRATION ) ; getResourceType ( resource ) . copyResource ( this , m_securityManager , resource , destination , siblingMode ) ; |
public class ContentElement { /** * Flush the rows from the last position to the current position
* @ param util the XML util
* @ param writer the destination
* @ param settingsElement the settings . xml representation
* @ throws IOException if the rows were not flushed */
public void flushRows ( final XMLUtil ... | this . ensureContentBegin ( util , writer ) ; final int lastTableIndex = this . tables . size ( ) - 1 ; if ( lastTableIndex == - 1 ) return ; int tableIndex = this . flushPosition . getTableIndex ( ) ; Table table = this . tables . get ( tableIndex ) ; if ( tableIndex < lastTableIndex ) { table . flushRemainingRowsFrom... |
public class VertxCompletableFuture { /** * Returns a new CompletableFuture that is asynchronously completed by a action running in the provided
* Vert . x worker thread pool .
* This method is different from { @ link CompletableFuture # runAsync ( Runnable ) } as it does not use a fork join
* executor , but the ... | return runBlockingAsyncOn ( Objects . requireNonNull ( vertx ) . getOrCreateContext ( ) , worker , runnable ) ; |
public class CmsTemplateMapperConfiguration { /** * Gets the mapped formatter configuration structure id string for another formatter configuration structure id string . < p >
* @ param id the structure id of a formatter configuration as a string
* @ return the mapped formatter configuration structure id of a strin... | CmsUUID resultId = m_formatterConfigMap . get ( new CmsUUID ( id ) ) ; if ( resultId == null ) { return null ; } return resultId . toString ( ) ; |
public class Server { /** * Uses autogenerated selfsigned certificate . */
public Server jdkSsl ( ) throws SSLException , CertificateException { } } | SelfSignedCertificate cert = new SelfSignedCertificate ( ) ; sslContext = SslContextBuilder . forServer ( cert . certificate ( ) , cert . privateKey ( ) ) . sslProvider ( SslProvider . JDK ) . build ( ) ; return this ; |
public class InstanceImpl { /** * Class index .
* @ return the int */
@ Override public int classIndex ( ) { } } | int classIndex = instanceHeader . classIndex ( ) ; // return ? classIndex : 0;
if ( classIndex == Integer . MAX_VALUE ) if ( this . instanceHeader . instanceInformation . range != null ) classIndex = instanceHeader . instanceInformation . range . getStart ( ) ; else classIndex = 0 ; return classIndex ; |
public class BaseXmlTrxMessageIn { /** * Get the unmarshaller .
* @ return */
public BaseConvertToMessage getConvertToMessage ( ) { } } | if ( m_convertToMessage == null ) { BaseMessageHeader trxMessageHeader = this . getMessage ( ) . getMessageHeader ( ) ; String strMessageClass = ( String ) trxMessageHeader . get ( TrxMessageHeader . MESSAGE_MARSHALLER_CLASS ) ; String strPackage = ( String ) trxMessageHeader . get ( TrxMessageHeader . BASE_PACKAGE ) ;... |
public class StreamPersistedValueData { /** * { @ inheritDoc } */
public PersistedValueData createPersistedCopy ( int orderNumber ) throws IOException { } } | if ( url != null ) return new StreamPersistedValueData ( orderNumber , url , tempFile , spoolConfig ) ; return super . createPersistedCopy ( orderNumber ) ; |
public class HttpClientResourceAdaptor { /** * ( non - Javadoc )
* @ see
* javax . slee . resource . ResourceAdaptor # eventUnreferenced ( javax . slee . resource
* . ActivityHandle , javax . slee . resource . FireableEventType , java . lang . Object ,
* javax . slee . Address , javax . slee . resource . Receiv... | if ( tracer . isFineEnabled ( ) ) { tracer . fine ( String . format ( "Event=%s unreferenced" , arg2 ) ) ; } if ( arg2 instanceof ResponseEvent ) { ResponseEvent event = ( ResponseEvent ) arg2 ; HttpResponse response = event . getHttpResponse ( ) ; // May be this event is carrying Exception and not actual Response
// i... |
public class InternalWikiScannerContext { /** * Waiting for following events to know if the macro is inline or not . */
public void onMacro ( String name , WikiParameters params , String content ) { } } | checkBlockContainer ( ) ; fMacroName = name ; fMacroParameters = params ; fMacroContent = content ; |
public class Preconditions { /** * A { @ code double } specialized version of { @ link # checkPreconditions ( Object ,
* ContractConditionType [ ] ) }
* @ param value The value
* @ param conditions The conditions the value must obey
* @ return value
* @ throws PreconditionViolationException If any of the cond... | final Violations violations = innerCheckAllDouble ( value , conditions ) ; if ( violations != null ) { throw new PreconditionViolationException ( failedMessage ( Double . valueOf ( value ) , violations ) , null , violations . count ( ) ) ; } return value ; |
public class FlowController { /** * Return the user ' s currently selected Locale .
* @ param request the current request .
* @ return the user ' s currently selected Locale , stored in the session .
* @ deprecated Use { @ link # getLocale } or { @ link # retrieveUserLocale } . */
protected Locale getLocale ( Htt... | HttpSession session = request . getSession ( ) ; Locale locale = ( Locale ) session . getAttribute ( Globals . LOCALE_KEY ) ; return locale != null ? locale : DEFAULT_LOCALE ; |
public class AssociateTeamMemberRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( AssociateTeamMemberRequest associateTeamMemberRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( associateTeamMemberRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( associateTeamMemberRequest . getProjectId ( ) , PROJECTID_BINDING ) ; protocolMarshaller . marshall ( associateTeamMemberRequest . getClientRequestToken ( ) ,... |
public class BatchGetItemResult { /** * Table names and the respective item attributes from the tables .
* Returns a reference to this object so that method calls can be chained together .
* @ param responses Table names and the respective item attributes from the tables .
* @ return A reference to this updated o... | setResponses ( responses ) ; return this ; |
public class PdfUtilities { /** * Converts PDF to TIFF format .
* @ param inputPdfFile input file
* @ return a multi - page TIFF image
* @ throws IOException */
public static File convertPdf2Tiff ( File inputPdfFile ) throws IOException { } } | if ( PDFBOX . equals ( System . getProperty ( PDF_LIBRARY ) ) ) { return PdfBoxUtilities . convertPdf2Tiff ( inputPdfFile ) ; } else { try { return PdfGsUtilities . convertPdf2Tiff ( inputPdfFile ) ; } catch ( Exception e ) { System . setProperty ( PDF_LIBRARY , PDFBOX ) ; return convertPdf2Tiff ( inputPdfFile ) ; } } |
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EClass getIfcSpecularHighlightSelect ( ) { } } | if ( ifcSpecularHighlightSelectEClass == null ) { ifcSpecularHighlightSelectEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 1162 ) ; } return ifcSpecularHighlightSelectEClass ; |
public class CommitsApi { /** * Get the comments of a commit in a project .
* < pre > < code > GitLab Endpoint : GET / projects / : id / repository / commits / : sha / comments < / code > < / pre >
* @ param projectIdOrPath the project in the form of an Integer ( ID ) , String ( path ) , or Project instance
* @ p... | return ( getComments ( projectIdOrPath , sha , getDefaultPerPage ( ) ) . all ( ) ) ; |
public class CollisionConfig { /** * Create an collision from its node .
* @ param node The collision node ( must not be < code > null < / code > ) .
* @ return The collision instance .
* @ throws LionEngineException If error when reading collision data . */
public static Collision createCollision ( XmlReader nod... | Check . notNull ( node ) ; final String name = node . readString ( ATT_NAME ) ; final int offsetX = node . readInteger ( ATT_OFFSETX ) ; final int offsetY = node . readInteger ( ATT_OFFSETY ) ; final int width = node . readInteger ( ATT_WIDTH ) ; final int height = node . readInteger ( ATT_HEIGHT ) ; final boolean mirr... |
public class AttachmentVersioningResourcesImpl { /** * Get all versions of an attachment .
* It mirrors to the following Smartsheet REST API method : GET / sheets / { sheetId } / attachments / { attachmentId } / versions
* @ param sheetId the id
* @ param attachmentId the attachment id
* @ param parameters the ... | String path = "sheets/" + sheetId + "/attachments/" + attachmentId + "/versions" ; if ( parameters != null ) { path += parameters . toQueryString ( ) ; } return this . listResourcesWithWrapper ( path , Attachment . class ) ; |
public class ImmutableRoaringBitmap { /** * Bitwise ANDNOT ( difference ) operation for the given range , rangeStart ( inclusive ) and rangeEnd
* ( exclusive ) . The provided bitmaps are * not * modified . This operation is thread - safe as long as
* the provided bitmaps remain unchanged .
* @ param x1 first bitm... | MutableRoaringBitmap . rangeSanityCheck ( rangeStart , rangeEnd ) ; MutableRoaringBitmap rb1 = selectRangeWithoutCopy ( x1 , rangeStart , rangeEnd ) ; MutableRoaringBitmap rb2 = selectRangeWithoutCopy ( x2 , rangeStart , rangeEnd ) ; return andNot ( rb1 , rb2 ) ; |
public class LongMultiset { /** * Remove the specified occurrences from the specified elements .
* The elements will be removed from this set if the occurrences equals to or less than 0 after the operation .
* @ param c
* @ param occurrences
* the occurrences to remove if the element is in the specified collect... | checkOccurrences ( occurrences ) ; if ( N . isNullOrEmpty ( c ) || occurrences == 0 ) { return false ; } boolean result = false ; for ( Object e : c ) { if ( result == false ) { result = remove ( e , occurrences ) ; } else { remove ( e , occurrences ) ; } } return result ; |
public class ListPullRequestsRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ListPullRequestsRequest listPullRequestsRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( listPullRequestsRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( listPullRequestsRequest . getRepositoryName ( ) , REPOSITORYNAME_BINDING ) ; protocolMarshaller . marshall ( listPullRequestsRequest . getAuthorArn ( ) , AUTHORA... |
public class ObjectMapper { /** * Creates a SQL query string to get objects for this ObjectMapper . */
public String buildSQL ( ) { } } | mTables = new Hashtable ( ) ; mColumns = new Vector ( ) ; String key = null ; for ( Enumeration keys = mPropertiesMap . keys ( ) ; keys . hasMoreElements ( ) ; ) { key = ( String ) keys . nextElement ( ) ; // Get columns to select
String column = ( String ) mPropertiesMap . get ( key ) ; mColumns . addElement ( column ... |
public class StringParser { /** * Parse the given { @ link String } as boolean value . All values that are equal
* to " true " ( ignoring case ) will result in < code > true < / code > return values .
* All values that are equal to " false " ( ignoring case ) will result in
* < code > false < / code > return valu... | // Do we need to start thinking at all ?
if ( sStr != null && sStr . length ( ) > 0 ) { // Is it true ?
if ( sStr . equalsIgnoreCase ( "true" ) ) return true ; // Is it false ?
if ( sStr . equalsIgnoreCase ( "false" ) ) return false ; } // Neither true nor false
return bDefault ; |
public class Utilities { /** * Samples a set of m integers without replacement from the range [ 0 , . . . , n - 1 ] .
* @ param m The number of integers to return .
* @ param n The number of integers from which to sample .
* @ return The sample as an unsorted integer array . */
public static int [ ] sampleWithout... | // This implements a modified form of the genshuf ( ) function from
// Programming Pearls pg . 129.
// TODO : Design a faster method that only generates min ( m , n - m ) integers .
int [ ] array = getIndexArray ( n ) ; for ( int i = 0 ; i < m ; i ++ ) { int j = Prng . nextInt ( n - i ) + i ; // Swap array [ i ] and ar... |
public class ZealotKhala { /** * 生成 " IS NOT NULL " 的SQL片段 .
* < p > 示例 : 传入 { " a . name " } 参数 , 生成的SQL片段为 : " a . name IS NOT NULL " < / p >
* @ param field 数据库字段
* @ return ZealotKhala实例 */
public ZealotKhala isNotNull ( String field ) { } } | return this . doIsNull ( ZealotConst . ONE_SPACE , field , true , false ) ; |
public class DoradusClient { /** * Convenient method to lookup storageService of the application
* @ param restClient
* @ param applicationName
* @ return storage service name */
private static String lookupStorageServiceByApp ( RESTClient restClient , String applicationName ) { } } | Utils . require ( applicationName != null , "Missing application name" ) ; if ( applicationName != null ) { ApplicationDefinition appDef = Command . getAppDef ( restClient , applicationName ) ; Utils . require ( appDef != null , "Unknown application: %s" , applicationName ) ; return appDef . getStorageService ( ) ; } r... |
public class MethodCompiler { /** * Set field in this class
* < p > Stack : . . . , value = & gt ; . . .
* @ param name
* @ throws IOException */
public void putField ( String name ) throws IOException { } } | VariableElement field = El . getField ( subClass , name ) ; if ( field == null ) { throw new IllegalArgumentException ( "field " + name + " not found" ) ; } putField ( field ) ; |
public class DayOpeningHours { /** * Determines of the hours of both days overlap . The day is ignored for this comparison .
* @ param other
* Other day to compare the hours with .
* @ return { @ literal true } if at least one minute is the same for both days . */
public final boolean overlaps ( @ NotNull final D... | Contract . requireArgNotNull ( "other" , other ) ; return hourRanges . overlaps ( other . hourRanges ) ; |
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link SecondDefiningParameterType } { @ code > }
* @ param value
* Java instance representing xml element ' s value .
* @ return
* the new instance of { @ link JAXBElement } { @ code < } { @ link SecondDefiningParame... | return new JAXBElement < SecondDefiningParameterType > ( _SecondDefiningParameter_QNAME , SecondDefiningParameterType . class , null , value ) ; |
public class FessMessages { /** * Add the created action message for the key ' success . upload _ mapping _ file ' with parameters .
* < pre >
* message : Uploaded Mapping file .
* < / pre >
* @ param property The property name for the message . ( NotNull )
* @ return this . ( NotNull ) */
public FessMessages... | assertPropertyNotNull ( property ) ; add ( property , new UserMessage ( SUCCESS_upload_mapping_file ) ) ; return this ; |
public class WsByteBufferUtils { /** * Convert a list of buffers to an int using the starting positions and ending
* limits .
* @ param list
* @ param positions
* @ param limits
* @ return int */
public static final int asInt ( WsByteBuffer [ ] list , int [ ] positions , int [ ] limits ) { } } | return asInt ( asByteArray ( list , positions , limits ) ) ; |
public class DescribeGlobalTableSettingsResult { /** * The region specific settings for the global table .
* @ param replicaSettings
* The region specific settings for the global table . */
public void setReplicaSettings ( java . util . Collection < ReplicaSettingsDescription > replicaSettings ) { } } | if ( replicaSettings == null ) { this . replicaSettings = null ; return ; } this . replicaSettings = new java . util . ArrayList < ReplicaSettingsDescription > ( replicaSettings ) ; |
public class RetryPolicy { /** * Execute the given { @ link GenomicsRequest } and return the response .
* This method begins by creating an { @ code RetryPolicy . Instance } and then attempts to execute the
* request by invoking { @ link GenomicsRequest # execute } . If the request fails with an
* { @ link IOExce... | for ( Instance instance = createInstance ( ) ; true ; ) { try { return request . execute ( ) ; } catch ( IOException e ) { if ( ! instance . shouldRetry ( request , e ) ) { throw e ; } } } |
public class AfplibPackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EEnum getObjectAreaSizeSizeType ( ) { } } | if ( objectAreaSizeSizeTypeEEnum == null ) { objectAreaSizeSizeTypeEEnum = ( EEnum ) EPackage . Registry . INSTANCE . getEPackage ( AfplibPackage . eNS_URI ) . getEClassifiers ( ) . get ( 99 ) ; } return objectAreaSizeSizeTypeEEnum ; |
public class ArrayOfDoublesSketch { /** * Heapify the given Memory and seed as a ArrayOfDoublesSketch
* @ param mem the given Memory
* @ param seed the given seed
* @ return an ArrayOfDoublesSketch */
public static ArrayOfDoublesSketch heapify ( final Memory mem , final long seed ) { } } | final SerializerDeserializer . SketchType sketchType = SerializerDeserializer . getSketchType ( mem ) ; if ( sketchType == SerializerDeserializer . SketchType . ArrayOfDoublesQuickSelectSketch ) { return new HeapArrayOfDoublesQuickSelectSketch ( mem , seed ) ; } return new HeapArrayOfDoublesCompactSketch ( mem , seed )... |
public class FileDescriptorEx { /** * very consuming and problematic ! */
private boolean isCanonical ( final FileDescriptor file ) { } } | final FileDescriptorProto proto = file . toProto ( ) ; if ( proto . hasOptions ( ) && proto . getOptions ( ) . getUninterpretedOptionCount ( ) > 0 ) { return false ; } for ( final FieldDescriptorProto field : proto . getExtensionList ( ) ) { if ( ! isFieldCanonical ( field ) ) { return false ; } } for ( final ServiceDe... |
public class CombinedDownloadTask { /** * Creates a CombinedDownloadTask from a DownloadTask .
* @ param task the download task
* @ param < T > the type of the DownloadTask
* @ return the CombinedDownloadTask
* @ throws NullPointerException if < code > task = = null < / code > */
public static < T > CombinedDow... | Objects . requireNonNull ( task ) ; return new SingleCombinedTask < T > ( task ) ; |
public class ProgressiveRendering { /** * Copies important fields from the current HTTP request and makes them available during { @ link # compute } .
* This is necessary because some model methods such as { @ link AbstractItem # getUrl } behave differently when called from a request . */
@ java . lang . SuppressWarn... | "rawtypes" , "unchecked" } ) // public RequestImpl ctor requires List < AncestorImpl > yet AncestorImpl is not public ! API design flaw
private static RequestImpl createMockRequest ( ) { RequestImpl currentRequest = ( RequestImpl ) Stapler . getCurrentRequest ( ) ; HttpServletRequest original = ( HttpServletRequest ) c... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.