signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class AdapterRegistry { /** * Return true if an adapter can be found to adapt the given input into the given output type . */
public boolean canAdapt ( Object input , Class < ? > outputType ) { } } | Class < ? > inputType = input . getClass ( ) ; Adapter a = findAdapter ( input , inputType , outputType ) ; return a != null ; |
public class GvmSpace { /** * Note : ( m1 + m2 ) never zero */
public double variance ( double m1 , Object pt1 , Object ptSqr1 , double m2 , Object pt2 , Object ptSqr2 ) { } } | // compute the total mass
double m0 = m1 + m2 ; // compute the new sum
Object pt0 = newCopy ( pt1 ) ; add ( pt0 , pt2 ) ; // compute the new sum of squares
Object ptSqr0 = newCopy ( ptSqr1 ) ; add ( ptSqr0 , ptSqr2 ) ; // compute the variance
return variance ( m0 , pt0 , ptSqr0 ) ; |
public class Keys { /** * Returns a key for the type provided by , or injected by this key . For
* example , if this is a key for a { @ code Provider < Foo > } , this returns the
* key for { @ code Foo } . This retains annotations and supports both Provider
* keys and MembersInjector keys . */
static String getBuiltInBindingsKey ( String key ) { } } | int start = startOfType ( key ) ; if ( substringStartsWith ( key , start , PROVIDER_PREFIX ) ) { return extractKey ( key , start , key . substring ( 0 , start ) , PROVIDER_PREFIX ) ; } else if ( substringStartsWith ( key , start , MEMBERS_INJECTOR_PREFIX ) ) { return extractKey ( key , start , "members/" , MEMBERS_INJECTOR_PREFIX ) ; } else { return null ; } |
public class ListInstancesResult { /** * Summary information about the instances that are associated with the specified service .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setInstances ( java . util . Collection ) } or { @ link # withInstances ( java . util . Collection ) } if you want to
* override the existing values .
* @ param instances
* Summary information about the instances that are associated with the specified service .
* @ return Returns a reference to this object so that method calls can be chained together . */
public ListInstancesResult withInstances ( InstanceSummary ... instances ) { } } | if ( this . instances == null ) { setInstances ( new java . util . ArrayList < InstanceSummary > ( instances . length ) ) ; } for ( InstanceSummary ele : instances ) { this . instances . add ( ele ) ; } return this ; |
public class PoolStopResizeOptions { /** * Set the time the request was issued . Client libraries typically set this to the current system clock time ; set it explicitly if you are calling the REST API directly .
* @ param ocpDate the ocpDate value to set
* @ return the PoolStopResizeOptions object itself . */
public PoolStopResizeOptions withOcpDate ( DateTime ocpDate ) { } } | if ( ocpDate == null ) { this . ocpDate = null ; } else { this . ocpDate = new DateTimeRfc1123 ( ocpDate ) ; } return this ; |
public class AdminToolQuartzServiceImpl { /** * / * ( non - Javadoc )
* @ see de . chandre . admintool . quartz . AdminToolQuartzService # interruptJob ( java . lang . String , java . lang . String ) */
@ Override public void interruptJob ( String jobGroup , String jobName ) throws SchedulerException { } } | if ( ! config . isInterruptJobAllowed ( ) ) { LOGGER . warn ( "not allowed to interrupt any job" ) ; return ; } JobKey jobKey = new JobKey ( jobName , jobGroup ) ; if ( isInteruptable ( jobKey ) ) { List < JobExecutionContext > executingJobs = scheduler . getCurrentlyExecutingJobs ( ) ; JobDetail jobDetail = scheduler . getJobDetail ( jobKey ) ; for ( JobExecutionContext jobExecutionContext : executingJobs ) { JobDetail execJobDetail = jobExecutionContext . getJobDetail ( ) ; if ( execJobDetail . getKey ( ) . equals ( jobDetail . getKey ( ) ) ) { if ( LOGGER . isDebugEnabled ( ) ) LOGGER . debug ( String . format ( "interrupting job (%s, %s)" , jobDetail . getKey ( ) . getGroup ( ) , jobDetail . getKey ( ) . getName ( ) ) ) ; ( ( InterruptableJob ) jobExecutionContext . getJobInstance ( ) ) . interrupt ( ) ; } } } |
public class CollectionUtil { /** * Adds all items returned by the iterator to the supplied collection and
* returns the supplied collection . */
@ ReplacedBy ( "com.google.common.collect.Iterators#addAll()" ) public static < T , C extends Collection < T > > C addAll ( C col , Iterator < ? extends T > iter ) { } } | while ( iter . hasNext ( ) ) { col . add ( iter . next ( ) ) ; } return col ; |
public class COSBlockOutputStream { /** * Close the stream .
* This will not return until the upload is complete or the attempt to perform
* the upload has failed . Exceptions raised in this method are indicative that
* the write has failed and data is at risk of being lost .
* @ throws IOException on any failure */
@ Override public void close ( ) throws IOException { } } | if ( closed . getAndSet ( true ) ) { // already closed
LOG . debug ( "Ignoring close() as stream is already closed" ) ; return ; } COSDataBlocks . DataBlock block = getActiveBlock ( ) ; boolean hasBlock = hasActiveBlock ( ) ; LOG . debug ( "{}: Closing block #{}: current block= {}" , this , blockCount , hasBlock ? block : "(none)" ) ; try { if ( multiPartUpload == null ) { if ( hasBlock ) { // no uploads of data have taken place , put the single block up .
// This must happen even if there is no data , so that 0 byte files
// are created .
putObject ( ) ; } } else { // there has already been at least one block scheduled for upload ;
// put up the current then wait
if ( hasBlock && block . hasData ( ) ) { // send last part
uploadCurrentBlock ( ) ; } // wait for the partial uploads to finish
final List < PartETag > partETags = multiPartUpload . waitForAllPartUploads ( ) ; // then complete the operation
multiPartUpload . complete ( partETags ) ; } LOG . debug ( "Upload complete for {}" , writeOperationHelper ) ; } catch ( IOException ioe ) { writeOperationHelper . writeFailed ( ioe ) ; throw ioe ; } finally { closeAll ( LOG , block , blockFactory ) ; closeAll ( LOG ) ; clearActiveBlock ( ) ; } // All end of write operations , including deleting fake parent directories
writeOperationHelper . writeSuccessful ( ) ; |
public class Quaternionf { /** * / * ( non - Javadoc )
* @ see org . joml . Quaternionfc # getAsMatrix4x3f ( java . nio . ByteBuffer ) */
public ByteBuffer getAsMatrix4x3f ( ByteBuffer dest ) { } } | MemUtil . INSTANCE . putMatrix4x3f ( this , dest . position ( ) , dest ) ; return dest ; |
public class FessMultipartRequestHandler { @ Override public void rollback ( ) { } } | final Iterator < MultipartFormFile > iter = elementsFile . values ( ) . iterator ( ) ; while ( iter . hasNext ( ) ) { final MultipartFormFile formFile = iter . next ( ) ; formFile . destroy ( ) ; } |
public class Syslog { /** * Use createInstance ( protocol , config ) to create your own Syslog instance .
* < p > First , create an implementation of SyslogConfigIF , such as UdpNetSyslogConfig . < / p >
* < p > Second , configure that configuration instance . < / p >
* < p > Third , call createInstance ( protocol , config ) using a short & amp ; simple
* String for the protocol argument . < / p >
* < p > Fourth , either use the returned instance of SyslogIF , or in later code
* call getInstance ( protocol ) with the protocol chosen in the previous step . < / p >
* @ param protocol
* @ param config
* @ return Returns an instance of SyslogIF .
* @ throws SyslogRuntimeException */
public static SyslogIF createInstance ( String protocol , SyslogConfigIF config ) throws SyslogRuntimeException { } } | Preconditions . checkArgument ( ! StringUtils . isBlank ( protocol ) , "Instance protocol cannot be null or empty" ) ; Preconditions . checkArgument ( config != null , "SyslogConfig cannot be null" ) ; String syslogProtocol = protocol . toLowerCase ( ) ; SyslogIF syslog = null ; synchronized ( instances ) { Preconditions . checkState ( ! instances . containsKey ( syslogProtocol ) , "Syslog protocol \"%s\" already defined" , protocol ) ; try { Class < ? extends SyslogIF > syslogClass = config . getSyslogClass ( ) ; syslog = syslogClass . newInstance ( ) ; } catch ( ClassCastException cse ) { if ( ! config . isThrowExceptionOnInitialize ( ) ) { throw new SyslogRuntimeException ( cse ) ; } else { return null ; } } catch ( IllegalAccessException iae ) { if ( ! config . isThrowExceptionOnInitialize ( ) ) { throw new SyslogRuntimeException ( iae ) ; } else { return null ; } } catch ( InstantiationException ie ) { if ( ! config . isThrowExceptionOnInitialize ( ) ) { throw new SyslogRuntimeException ( ie ) ; } else { return null ; } } syslog . initialize ( syslogProtocol , config ) ; instances . put ( syslogProtocol , syslog ) ; } return syslog ; |
public class CmsEditUserAddInfoDialog { /** * Creates a new additional information bean object . < p >
* @ param user the user to create the bean for
* @ return a new additional information bean object */
private List < CmsUserAddInfoBean > createAddInfoList ( CmsUser user ) { } } | List < CmsUserAddInfoBean > addInfoList = new ArrayList < CmsUserAddInfoBean > ( ) ; // add beans
Iterator < CmsWorkplaceUserInfoBlock > itBlocks = OpenCms . getWorkplaceManager ( ) . getUserInfoManager ( ) . getBlocks ( ) . iterator ( ) ; while ( itBlocks . hasNext ( ) ) { CmsWorkplaceUserInfoBlock block = itBlocks . next ( ) ; Iterator < CmsWorkplaceUserInfoEntry > itEntries = block . getEntries ( ) . iterator ( ) ; while ( itEntries . hasNext ( ) ) { CmsWorkplaceUserInfoEntry entry = itEntries . next ( ) ; Object value = user . getAdditionalInfo ( entry . getKey ( ) ) ; if ( value == null ) { value = "" ; } addInfoList . add ( new CmsUserAddInfoBean ( entry . getKey ( ) , value . toString ( ) , entry . getClassType ( ) ) ) ; } } return addInfoList ; |
public class LdapTemplate { /** * { @ inheritDoc } */
@ Override public < T > T searchForObject ( LdapQuery query , ContextMapper < T > mapper ) { } } | SearchControls searchControls = searchControlsForQuery ( query , DONT_RETURN_OBJ_FLAG ) ; return searchForObject ( query . base ( ) , query . filter ( ) . encode ( ) , searchControls , mapper ) ; |
public class EventsHelper { /** * Bind a function to the mousedown event of each matched element .
* @ param jsScope
* Scope to use
* @ return the jQuery code */
public static ChainableStatement mousedown ( JsScope jsScope ) { } } | return new DefaultChainableStatement ( MouseEvent . MOUSEDOWN . getEventLabel ( ) , jsScope . render ( ) ) ; |
public class EnvUtil { /** * Production safety check . Protection for production env . */
public static boolean verifyEnvironment ( ) { } } | if ( ! PRODUCTION . equals ( getEnv ( ) ) ) { return true ; } else { File tokenFile = new File ( "/etc/xian/xian_runtime_production.token" ) ; if ( tokenFile . exists ( ) && tokenFile . isFile ( ) ) { String token = PlainFileUtil . readAll ( tokenFile ) ; return "cbab75c745ac9707cf75b719a76e81284abc04c0ae96e2506fd247e9a3d9ca04" . equals ( token ) ; } return false ; } |
public class FunctionInputDefBuilder { /** * Adds function input variables of the given type . */
public FunctionInputDefBuilder vars ( String type , AbstractVarDef ... vars ) { } } | for ( AbstractVarDef var : vars ) { var . setType ( type ) ; functionInputDef_ . addVarDef ( var ) ; } return this ; |
public class Scales { /** * Compute a linear scale for each dimension .
* @ param rel Relation
* @ return Scales , indexed starting with 0 ( like Vector , not database
* objects ! ) */
public static LinearScale [ ] calcScales ( Relation < ? extends SpatialComparable > rel ) { } } | int dim = RelationUtil . dimensionality ( rel ) ; DoubleMinMax [ ] minmax = DoubleMinMax . newArray ( dim ) ; LinearScale [ ] scales = new LinearScale [ dim ] ; // analyze data
for ( DBIDIter iditer = rel . iterDBIDs ( ) ; iditer . valid ( ) ; iditer . advance ( ) ) { SpatialComparable v = rel . get ( iditer ) ; if ( v instanceof NumberVector ) { for ( int d = 0 ; d < dim ; d ++ ) { final double mi = v . getMin ( d ) ; if ( mi != mi ) { // NaN
continue ; } minmax [ d ] . put ( mi ) ; } } else { for ( int d = 0 ; d < dim ; d ++ ) { final double mi = v . getMin ( d ) ; if ( mi == mi ) { // No NaN
minmax [ d ] . put ( mi ) ; } final double ma = v . getMax ( d ) ; if ( ma == ma ) { // No NaN
minmax [ d ] . put ( ma ) ; } } } } // generate scales
for ( int d = 0 ; d < dim ; d ++ ) { scales [ d ] = new LinearScale ( minmax [ d ] . getMin ( ) , minmax [ d ] . getMax ( ) ) ; } return scales ; |
public class AstaFileReader { /** * Process a text - based PP file .
* @ param inputStream file input stream
* @ return ProjectFile instance */
private ProjectFile readTextFile ( InputStream inputStream ) throws MPXJException { } } | ProjectReader reader = new AstaTextFileReader ( ) ; addListeners ( reader ) ; return reader . read ( inputStream ) ; |
public class HttpResponse { /** * Returns the response body as twitter4j . JSONObject . < br >
* Disconnects the internal HttpURLConnection silently .
* @ return response body as twitter4j . JSONObject
* @ throws TwitterException when the response body is not in JSON Object format */
public JSONObject asJSONObject ( ) throws TwitterException { } } | if ( json == null ) { try { json = new JSONObject ( asString ( ) ) ; if ( CONF . isPrettyDebugEnabled ( ) ) { logger . debug ( json . toString ( 1 ) ) ; } else { logger . debug ( responseAsString != null ? responseAsString : json . toString ( ) ) ; } } catch ( JSONException jsone ) { if ( responseAsString == null ) { throw new TwitterException ( jsone . getMessage ( ) , jsone ) ; } else { throw new TwitterException ( jsone . getMessage ( ) + ":" + this . responseAsString , jsone ) ; } } finally { disconnectForcibly ( ) ; } } return json ; |
public class ObjectUtils { /** * Gets the value of a given property into a given bean .
* @ param < Q >
* the bean type .
* @ param bean
* the bean itself .
* @ param propertyName
* the property name .
* @ return the property value .
* @ see # getPropertyValue ( Object , String , Class ) */
public static < Q > Object getPropertyValue ( Q bean , String propertyName ) { } } | return ObjectUtils . getPropertyValue ( bean , propertyName , Object . class ) ; |
public class MtasJoinQParser { /** * ( non - Javadoc )
* @ see org . apache . solr . search . QParser # parse ( ) */
@ Override public Query parse ( ) throws SyntaxError { } } | if ( id == null ) { throw new SyntaxError ( "no " + MTAS_JOIN_QPARSER_COLLECTION ) ; } else if ( fields == null ) { throw new SyntaxError ( "no " + MTAS_JOIN_QPARSER_FIELD ) ; } else { BooleanQuery . Builder booleanQueryBuilder = new BooleanQuery . Builder ( ) ; MtasSolrCollectionCache mtasSolrJoinCache = null ; for ( PluginHolder < SearchComponent > item : req . getCore ( ) . getSearchComponents ( ) . getRegistry ( ) . values ( ) ) { if ( item . get ( ) instanceof MtasSolrSearchComponent ) { mtasSolrJoinCache = ( ( MtasSolrSearchComponent ) item . get ( ) ) . getCollectionCache ( ) ; } } if ( mtasSolrJoinCache != null ) { Automaton automaton ; try { automaton = mtasSolrJoinCache . getAutomatonById ( id ) ; if ( automaton != null ) { for ( String field : fields ) { booleanQueryBuilder . add ( new AutomatonQuery ( new Term ( field ) , automaton ) , Occur . SHOULD ) ; } } else { throw new IOException ( "no data for collection '" + id + "'" ) ; } } catch ( IOException e ) { throw new SyntaxError ( "could not construct automaton: " + e . getMessage ( ) , e ) ; } return booleanQueryBuilder . build ( ) ; } else { throw new SyntaxError ( "no MtasSolrSearchComponent found" ) ; } } |
public class EsperStatement { /** * Stops the underlying native statement from applying its filter query . */
public void stop ( ) { } } | if ( LOG . isInfoEnabled ( ) ) { LOG . info ( "Esper statement [" + epl + "] being stopped" ) ; } this . epStatement . stop ( ) ; if ( LOG . isInfoEnabled ( ) ) { LOG . info ( "Esper statement [" + epl + "] stopped" ) ; } |
public class MACCSFingerprinter { /** * { @ inheritDoc } */
@ Override public IBitFingerprint getBitFingerprint ( IAtomContainer container ) throws CDKException { } } | MaccsKey [ ] keys = keys ( container . getBuilder ( ) ) ; BitSet fp = new BitSet ( keys . length ) ; // init SMARTS invariants ( connectivity , degree , etc )
SmartsPattern . prepare ( container ) ; final int numAtoms = container . getAtomCount ( ) ; final GraphUtil . EdgeToBondMap bmap = GraphUtil . EdgeToBondMap . withSpaceFor ( container ) ; final int [ ] [ ] adjlist = GraphUtil . toAdjList ( container , bmap ) ; for ( int i = 0 ; i < keys . length ; i ++ ) { final MaccsKey key = keys [ i ] ; final Pattern pattern = key . pattern ; switch ( key . smarts ) { case "[!*]" : break ; case "[!0]" : for ( IAtom atom : container . atoms ( ) ) { if ( atom . getMassNumber ( ) != null ) { fp . set ( i ) ; break ; } } break ; // ring bits
case "[R]1@*@*@1" : // 3M RING bit22
case "[R]1@*@*@*@1" : // 4M RING bit11
case "[R]1@*@*@*@*@1" : // 5M RING bit96
case "[R]1@*@*@*@*@*@1" : // 6M RING bit163 , x2 = bit145
case "[R]1@*@*@*@*@*@*@1" : // 7M RING , bit19
case "[R]1@*@*@*@*@*@*@*@1" : // 8M RING , bit101
// handled separately
break ; case "(*).(*)" : // bit 166 ( * ) . ( * ) we can match this in SMARTS but it ' s faster to just
// count the number of components or in this case try to traverse the
// component , iff there are some atoms not visited we have more than
// one component
boolean [ ] visit = new boolean [ numAtoms ] ; if ( numAtoms > 1 && visitPart ( visit , adjlist , 0 , - 1 ) < numAtoms ) fp . set ( 165 ) ; break ; default : if ( key . count == 0 ) { if ( pattern . matches ( container ) ) fp . set ( i ) ; } else { // check if there are at least ' count ' unique hits , key . count = 0
// means find at least one match hence we add 1 to out limit
if ( pattern . matchAll ( container ) . uniqueAtoms ( ) . atLeast ( key . count + 1 ) ) fp . set ( i ) ; } break ; } } // Ring Bits
// threshold = 126 , see AllRingsFinder . Threshold . PubChem _ 97
if ( numAtoms > 2 ) { AllCycles allcycles = new AllCycles ( adjlist , Math . min ( 8 , numAtoms ) , 126 ) ; int numArom = 0 ; for ( int [ ] path : allcycles . paths ( ) ) { // length is + 1 as we repeat the closure vertex
switch ( path . length ) { case 4 : // 3M bit22
fp . set ( 21 ) ; break ; case 5 : // 4M bit11
fp . set ( 10 ) ; break ; case 6 : // 5M bit96
fp . set ( 95 ) ; break ; case 7 : // 6M bit163 - > bit145 , bit124 numArom > 1
if ( numArom < 2 ) { if ( isAromPath ( path , bmap ) ) { numArom ++ ; if ( numArom == 2 ) fp . set ( 124 ) ; } } if ( fp . get ( 162 ) ) { fp . set ( 144 ) ; } else { fp . set ( 162 ) ; } break ; case 8 : // 7M bit19
fp . set ( 18 ) ; break ; case 9 : // 8M bit101
fp . set ( 100 ) ; break ; } } } return new BitSetFingerprint ( fp ) ; |
public class TypeUtils { /** * Searching for maximum type to which both types could be downcasted . For example , for { @ code Integer }
* and { @ code Double } common class would be { @ code ? extends Number & Comparable < Number > } ( because both
* { @ code Integer } and { @ code Double } extend { @ code Number } and implement { @ code Comparable } and so both types
* could be downcasted to this common type ) .
* Generics are also counted , e . g . common type for { @ code List < Double > } and { @ code List < Integer > } is
* { @ code List < Number & Comparable < Number > > } . Generics are tracked on all depths ( in order to compute maximally
* accurate type ) .
* Types may be common only in implemented interfaces : e . g . for { @ code class One implements Comparable }
* and { @ code class Two implements Comparable } common type would be { @ code Comparable } .
* All shared interfaces are returned as wildcard ( { @ link WildcardType } meaning
* { @ code ? extends BaseType & IFace1 & Iface2 } ) .
* For returned wildcard , contained types will be sorted as : class , interface from not java package , interface
* with generic ( s ) , by name . So order of types will always be predictable and first upper bound will be the most
* specific type .
* Returned type is maximally accurate common type , but if you need only base class without interfaces
* ( and use interfaces only if direct base class can ' t be found ) then you can call
* { @ code CommonTypeFactory . build ( one , two , false ) } directly .
* Primitives are boxed for comparison ( e . g . { @ code int - > Integer } ) so even for two { @ code int } common type
* would be { @ code Integer } . The exception is primitive arrays : they can ' t be unboxed ( because { @ code int [ ] }
* and { @ code Integer [ ] } are not the same ) and so the result will be { @ code Object } for primitive arrays in
* all cases except when types are equal .
* NOTE : returned type will not contain variables ( { @ link TypeVariable } ) , even if provided types contain them
* ( all variables are solved to upper bound ) . For example , { @ code List < T extends Number > } will be counted as
* { @ code List < Number > } and { @ code Set < N > } as { @ code Set < Object > } .
* @ param one first type
* @ param two second type
* @ return maximum class assignable to both types or { @ code Object } if classes are incompatible */
public static Type getCommonType ( final Type one , final Type two ) { } } | return CommonTypeFactory . build ( one , two , true ) ; |
public class CommerceWishListPersistenceImpl { /** * Returns an ordered range of all the commerce wish lists where userId = & # 63 ; and createDate & lt ; & # 63 ; .
* Useful when paginating results . Returns a maximum of < code > end - start < / code > instances . < code > start < / code > and < code > end < / code > are not primary keys , they are indexes in the result set . Thus , < code > 0 < / code > refers to the first result in the set . Setting both < code > start < / code > and < code > end < / code > to { @ link QueryUtil # ALL _ POS } will return the full result set . If < code > orderByComparator < / code > is specified , then the query will include the given ORDER BY logic . If < code > orderByComparator < / code > is absent and pagination is required ( < code > start < / code > and < code > end < / code > are not { @ link QueryUtil # ALL _ POS } ) , then the query will include the default ORDER BY logic from { @ link CommerceWishListModelImpl } . If both < code > orderByComparator < / code > and pagination are absent , for performance reasons , the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order .
* @ param userId the user ID
* @ param createDate the create date
* @ param start the lower bound of the range of commerce wish lists
* @ param end the upper bound of the range of commerce wish lists ( not inclusive )
* @ param orderByComparator the comparator to order the results by ( optionally < code > null < / code > )
* @ param retrieveFromCache whether to retrieve from the finder cache
* @ return the ordered range of matching commerce wish lists */
@ Override public List < CommerceWishList > findByU_LtC ( long userId , Date createDate , int start , int end , OrderByComparator < CommerceWishList > orderByComparator , boolean retrieveFromCache ) { } } | boolean pagination = true ; FinderPath finderPath = null ; Object [ ] finderArgs = null ; finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_U_LTC ; finderArgs = new Object [ ] { userId , _getTime ( createDate ) , start , end , orderByComparator } ; List < CommerceWishList > list = null ; if ( retrieveFromCache ) { list = ( List < CommerceWishList > ) finderCache . getResult ( finderPath , finderArgs , this ) ; if ( ( list != null ) && ! list . isEmpty ( ) ) { for ( CommerceWishList commerceWishList : list ) { if ( ( userId != commerceWishList . getUserId ( ) ) || ( createDate . getTime ( ) <= commerceWishList . getCreateDate ( ) . getTime ( ) ) ) { list = null ; break ; } } } } if ( list == null ) { StringBundler query = null ; if ( orderByComparator != null ) { query = new StringBundler ( 4 + ( orderByComparator . getOrderByFields ( ) . length * 2 ) ) ; } else { query = new StringBundler ( 4 ) ; } query . append ( _SQL_SELECT_COMMERCEWISHLIST_WHERE ) ; query . append ( _FINDER_COLUMN_U_LTC_USERID_2 ) ; boolean bindCreateDate = false ; if ( createDate == null ) { query . append ( _FINDER_COLUMN_U_LTC_CREATEDATE_1 ) ; } else { bindCreateDate = true ; query . append ( _FINDER_COLUMN_U_LTC_CREATEDATE_2 ) ; } if ( orderByComparator != null ) { appendOrderByComparator ( query , _ORDER_BY_ENTITY_ALIAS , orderByComparator ) ; } else if ( pagination ) { query . append ( CommerceWishListModelImpl . ORDER_BY_JPQL ) ; } String sql = query . toString ( ) ; Session session = null ; try { session = openSession ( ) ; Query q = session . createQuery ( sql ) ; QueryPos qPos = QueryPos . getInstance ( q ) ; qPos . add ( userId ) ; if ( bindCreateDate ) { qPos . add ( new Timestamp ( createDate . getTime ( ) ) ) ; } if ( ! pagination ) { list = ( List < CommerceWishList > ) QueryUtil . list ( q , getDialect ( ) , start , end , false ) ; Collections . sort ( list ) ; list = Collections . unmodifiableList ( list ) ; } else { list = ( List < CommerceWishList > ) QueryUtil . list ( q , getDialect ( ) , start , end ) ; } cacheResult ( list ) ; finderCache . putResult ( finderPath , finderArgs , list ) ; } catch ( Exception e ) { finderCache . removeResult ( finderPath , finderArgs ) ; throw processException ( e ) ; } finally { closeSession ( session ) ; } } return list ; |
public class CollectionUtils { /** * Wrap set set .
* @ param < T > the type parameter
* @ param source the source
* @ return the set */
public static < T > Set < T > wrapSet ( final T source ) { } } | val list = new LinkedHashSet < T > ( ) ; if ( source != null ) { list . add ( source ) ; } return list ; |
public class E { /** * Throws out an { @ link InvalidStateException } with message specified . */
public static InvalidStateException invalidState ( String msg , Object ... args ) { } } | throw new InvalidStateException ( S . fmt ( msg , args ) ) ; |
public class ArgumentMatchers { /** * Returns an equals matcher for the given value . */
@ SuppressWarnings ( "unchecked" ) public static < T > Matcher < T > eq ( T value ) { } } | return ( Matcher < T > ) new Equals ( value ) ; |
public class JobXMLDescriptorImpl { /** * If not already created , a new < code > listeners < / code > element with the given value will be created .
* Otherwise , the existing < code > listeners < / code > element will be returned .
* @ return a new or existing instance of < code > Listeners < JobXMLDescriptor > < / code > */
public Listeners < JobXMLDescriptor > getOrCreateListeners ( ) { } } | Node node = model . getOrCreate ( "listeners" ) ; Listeners < JobXMLDescriptor > listeners = new ListenersImpl < JobXMLDescriptor > ( this , "listeners" , model , node ) ; return listeners ; |
public class SipCall { /** * The waitForCancelResponse ( ) method waits for a response to be received from the network for a
* sent CANCEL . Call this method after calling sendCancel ( ) .
* This method blocks until one of the following occurs : 1 ) A response message has been received .
* In this case , a value of true is returned . Call the getLastReceivedResponse ( ) method to get the
* response details . 2 ) A timeout occurs . A false value is returned in this case . 3 ) An error
* occurs . False is returned in this case .
* Regardless of the outcome , getReturnCode ( ) can be called after this method returns to get the
* status code : IE , the SIP response code received from the network ( defined in SipResponse , along
* with the corresponding textual equivalent ) or a SipUnit internal status / error code ( defined in
* SipSession , along with the corresponding textual equivalent ) . SipUnit internal codes are in a
* specially designated range ( SipSession . SIPUNIT _ INTERNAL _ RETURNCODE _ MIN and upward ) .
* @ param siptrans This is the object that was returned by method sendCancel ( ) . It identifies a
* specific Cancel transaction .
* @ param timeout The maximum amount of time to wait , in milliseconds . Use a value of 0 to wait
* indefinitely .
* @ return true if a response was received - in that case , call getReturnCode ( ) to get the status
* code that was contained in the received response , and / or call getLastReceivedResponse ( )
* to see the response details . Returns false if timeout or error . */
public boolean waitForCancelResponse ( SipTransaction siptrans , long timeout ) { } } | initErrorInfo ( ) ; if ( siptrans == null ) { returnCode = SipSession . INVALID_OPERATION ; errorMessage = ( String ) SipSession . statusCodeDescription . get ( new Integer ( returnCode ) ) + " - no RE-INVITE transaction object given" ; return false ; } EventObject response_event = parent . waitResponse ( siptrans , timeout ) ; if ( response_event == null ) { setErrorMessage ( parent . getErrorMessage ( ) ) ; setException ( parent . getException ( ) ) ; setReturnCode ( parent . getReturnCode ( ) ) ; return false ; } if ( response_event instanceof TimeoutEvent ) { setReturnCode ( SipPhone . TIMEOUT_OCCURRED ) ; setErrorMessage ( "A Timeout Event was received" ) ; return false ; } Response resp = ( ( ResponseEvent ) response_event ) . getResponse ( ) ; receivedResponses . add ( new SipResponse ( ( ResponseEvent ) response_event ) ) ; LOG . info ( "CANCEL response received: {}" , resp . toString ( ) ) ; setReturnCode ( resp . getStatusCode ( ) ) ; return true ; |
public class Cache { /** * visible for testing */
Object runOp ( Op op ) { } } | LOG . debug ( "Run: {}" , op ) ; recursive . set ( Boolean . TRUE ) ; try { if ( op . type == Op . Type . PUT || op . type == Op . Type . ALLOC ) return execOp ( op , null ) ; final long id = op . line ; CacheLine line = getLine ( id ) ; if ( line == null ) { Object res = handleOpNoLine ( op . type , op . line , op . getExtra ( ) ) ; if ( res != DIDNT_HANDLE ) return res ; else line = createNewCacheLine ( op ) ; } final Object res ; synchronized ( line ) { res = execOp ( op , line ) ; } receiveShortCircuit ( ) ; if ( res instanceof Op ) return runOp ( ( Op ) res ) ; return res ; } finally { recursive . remove ( ) ; } |
public class TaskQueuesStatisticsReader { /** * Make the request to the Twilio API to perform the read .
* @ param client TwilioRestClient with which to make the request
* @ return TaskQueuesStatistics ResourceSet */
@ Override public ResourceSet < TaskQueuesStatistics > read ( final TwilioRestClient client ) { } } | return new ResourceSet < > ( this , client , firstPage ( client ) ) ; |
public class SrvDate { /** * < p > Parse date from ISO8601 date - time string without TZ ,
* e . g . from 2001-07-04T12:08 . < / p >
* @ param pDateStr date in ISO8601 format
* @ param pAddParam additional params
* @ return String representation
* @ throws Exception - an exception */
@ Override public final Date fromIso8601DateTimeNoTz ( final String pDateStr , final Map < String , Object > pAddParam ) throws Exception { } } | return this . dateTimeNoTzFormatIso8601 . parse ( pDateStr ) ; |
public class RoadNetworkConstants { /** * Set the preferred name for the traffic direction on the roads .
* @ param name is the preferred name for the traffic direction on the roads .
* @ see # DEFAULT _ ATTR _ TRAFFIC _ DIRECTION */
public static void setPreferredAttributeNameForTrafficDirection ( String name ) { } } | final Preferences prefs = Preferences . userNodeForPackage ( RoadNetworkConstants . class ) ; if ( prefs != null ) { if ( name == null || "" . equals ( name ) || DEFAULT_ATTR_TRAFFIC_DIRECTION . equalsIgnoreCase ( name ) ) { // $ NON - NLS - 1 $
prefs . remove ( "TRAFFIC_DIRECTION_ATTR_NAME" ) ; // $ NON - NLS - 1 $
} else { prefs . put ( "TRAFFIC_DIRECTION_ATTR_NAME" , name ) ; // $ NON - NLS - 1 $
} } |
public class UpdatePipelineRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( UpdatePipelineRequest updatePipelineRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( updatePipelineRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( updatePipelineRequest . getId ( ) , ID_BINDING ) ; protocolMarshaller . marshall ( updatePipelineRequest . getName ( ) , NAME_BINDING ) ; protocolMarshaller . marshall ( updatePipelineRequest . getInputBucket ( ) , INPUTBUCKET_BINDING ) ; protocolMarshaller . marshall ( updatePipelineRequest . getRole ( ) , ROLE_BINDING ) ; protocolMarshaller . marshall ( updatePipelineRequest . getAwsKmsKeyArn ( ) , AWSKMSKEYARN_BINDING ) ; protocolMarshaller . marshall ( updatePipelineRequest . getNotifications ( ) , NOTIFICATIONS_BINDING ) ; protocolMarshaller . marshall ( updatePipelineRequest . getContentConfig ( ) , CONTENTCONFIG_BINDING ) ; protocolMarshaller . marshall ( updatePipelineRequest . getThumbnailConfig ( ) , THUMBNAILCONFIG_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class StreamHelper { /** * Read all characters from the passed reader into a char array .
* @ param aReader
* The reader to read from . May be < code > null < / code > .
* @ return The character array or < code > null < / code > if the reader is
* < code > null < / code > . */
@ Nullable public static char [ ] getAllCharacters ( @ Nullable @ WillClose final Reader aReader ) { } } | if ( aReader == null ) return null ; return getCopy ( aReader ) . getAsCharArray ( ) ; |
public class ApiOvhCloud { /** * Request access to a region
* REST : POST / cloud / project / { serviceName } / region
* @ param region [ required ] Region to add on your project
* @ param serviceName [ required ] The project id */
public OvhRegion project_serviceName_region_POST ( String serviceName , String region ) throws IOException { } } | String qPath = "/cloud/project/{serviceName}/region" ; StringBuilder sb = path ( qPath , serviceName ) ; HashMap < String , Object > o = new HashMap < String , Object > ( ) ; addBody ( o , "region" , region ) ; String resp = exec ( qPath , "POST" , sb . toString ( ) , o ) ; return convertTo ( resp , OvhRegion . class ) ; |
public class DefinitionHeaderProvider { /** * Implementation */
private Locale getUserLocale ( IPerson user ) { } } | // get user locale
Locale [ ] locales = localeStore . getUserLocales ( user ) ; LocaleManager localeManager = localeManagerFactory . createLocaleManager ( user , Arrays . asList ( locales ) ) ; return localeManager . getLocales ( ) . get ( 0 ) ; |
public class PlanAssembler { /** * Add a limit , and return the new root .
* @ param root top of the original plan
* @ return new plan ' s root node */
private AbstractPlanNode handleUnionLimitOperator ( AbstractPlanNode root ) { } } | // The coordinator ' s top limit graph fragment for a MP plan .
// If planning " order by . . . limit " , getNextUnionPlan ( )
// will have already added an order by to the coordinator frag .
// This is the only limit node in a SP plan
LimitPlanNode topLimit = m_parsedUnion . getLimitNodeTop ( ) ; assert ( topLimit != null ) ; return inlineLimitOperator ( root , topLimit ) ; |
public class NodeModelUtils { /** * / * @ Nullable */
public static ICompositeNode getNode ( /* @ Nullable */
EObject object ) { } } | if ( object == null ) return null ; List < Adapter > adapters = object . eAdapters ( ) ; for ( int i = 0 ; i < adapters . size ( ) ; i ++ ) { Adapter adapter = adapters . get ( i ) ; if ( adapter instanceof ICompositeNode ) return ( ICompositeNode ) adapter ; } return null ; |
public class QueryParserBase { /** * Iterates criteria list and concats query string fragments to form a valid query string to be used with
* { @ link org . apache . solr . client . solrj . SolrQuery # setQuery ( String ) }
* @ param criteria
* @ param domainType
* @ return
* @ since 4.0 */
protected String createQueryStringFromCriteria ( Criteria criteria , @ Nullable Class < ? > domainType ) { } } | return createQueryStringFromNode ( criteria , domainType ) ; |
public class DescribeLoadBalancersResult { /** * Information about the load balancers .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setLoadBalancerDescriptions ( java . util . Collection ) } or
* { @ link # withLoadBalancerDescriptions ( java . util . Collection ) } if you want to override the existing values .
* @ param loadBalancerDescriptions
* Information about the load balancers .
* @ return Returns a reference to this object so that method calls can be chained together . */
public DescribeLoadBalancersResult withLoadBalancerDescriptions ( LoadBalancerDescription ... loadBalancerDescriptions ) { } } | if ( this . loadBalancerDescriptions == null ) { setLoadBalancerDescriptions ( new com . amazonaws . internal . SdkInternalList < LoadBalancerDescription > ( loadBalancerDescriptions . length ) ) ; } for ( LoadBalancerDescription ele : loadBalancerDescriptions ) { this . loadBalancerDescriptions . add ( ele ) ; } return this ; |
public class WCOutputStream { /** * @ see javax . servlet . ServletOutputStream # println ( int ) */
public void println ( int i ) throws IOException { } } | String value = Integer . toString ( i ) ; this . output . write ( value . getBytes ( ) , 0 , value . length ( ) ) ; this . output . write ( CRLF , 0 , 2 ) ; |
public class CmsDocumentHtml { /** * Returns the raw text content of a given VFS resource containing HTML data . < p >
* @ see org . opencms . search . documents . I _ CmsSearchExtractor # extractContent ( CmsObject , CmsResource , I _ CmsSearchIndex ) */
public I_CmsExtractionResult extractContent ( CmsObject cms , CmsResource resource , I_CmsSearchIndex index ) throws CmsIndexException , CmsException { } } | logContentExtraction ( resource , index ) ; CmsFile file = readFile ( cms , resource ) ; try { CmsProperty encProp = cms . readPropertyObject ( resource , CmsPropertyDefinition . PROPERTY_CONTENT_ENCODING , true ) ; String encoding = encProp . getValue ( OpenCms . getSystemInfo ( ) . getDefaultEncoding ( ) ) ; return CmsExtractorHtml . getExtractor ( ) . extractText ( file . getContents ( ) , encoding ) ; } catch ( Exception e ) { throw new CmsIndexException ( Messages . get ( ) . container ( Messages . ERR_TEXT_EXTRACTION_1 , resource . getRootPath ( ) ) , e ) ; } |
public class NumaOptions { @ Nonnull public static NumaOptions node ( @ Nonnull NumaNodeOptions node ) { } } | NumaOptions self = new NumaOptions ( ) ; self . type = NumaOptionsType . node ; self . node = node ; return self ; |
public class AnnotationRef { /** * Writes an annotation valued field to the writer . */
private static < T extends Annotation > FieldWriter annotationFieldWriter ( final String name , final AnnotationRef < T > ref ) { } } | return new FieldWriter ( ) { @ Override public void write ( AnnotationVisitor visitor , Object value ) { ref . doWrite ( ref . annType . cast ( value ) , visitor . visitAnnotation ( name , ref . typeDescriptor ) ) ; } } ; |
public class RoadNetworkConstants { /** * Set the preferred values of traffic direction
* used in the attributes for the traffic direction on the roads .
* @ param direction a direction
* @ param values are the values for the given direction . */
public static void setPreferredAttributeValuesForTrafficDirection ( TrafficDirection direction , List < String > values ) { } } | int i = 0 ; for ( final String value : values ) { setPreferredAttributeValueForTrafficDirection ( direction , i , value ) ; ++ i ; } setPreferredAttributeValueForTrafficDirection ( direction , i , null ) ; |
public class PropertyFilter { /** * Returns a canonical instance , creating a new one if there isn ' t one
* already in the cache .
* @ throws IllegalArgumentException if property or operator is null */
@ SuppressWarnings ( "unchecked" ) static < S extends Storable > PropertyFilter < S > getCanonical ( ChainedProperty < S > property , RelOp op , int bindID ) { } } | return ( PropertyFilter < S > ) cCanonical . put ( new PropertyFilter < S > ( property , op , bindID , null ) ) ; |
public class Nfs3 { /** * / * ( non - Javadoc )
* @ see com . emc . ecs . nfsclient . nfs . Nfs # makeRemoveRequest ( byte [ ] , java . lang . String ) */
public Nfs3RemoveRequest makeRemoveRequest ( byte [ ] parentDirectoryFileHandle , String name ) throws FileNotFoundException { } } | return new Nfs3RemoveRequest ( parentDirectoryFileHandle , name , _credential ) ; |
public class ExecutionContextImpl { /** * Called when we have determined that this execution is going to be retried
* @ param t the Throwable that prompted the retry */
public void onRetry ( Throwable t ) { } } | try { this . retries ++ ; debugRelativeTime ( "onRetry: " + this . retries ) ; metricRecorder . incrementRetriesCount ( ) ; if ( timeout != null ) { timeout . restart ( ) ; attemptStartTime = System . nanoTime ( ) ; } onAttemptComplete ( t ) ; } catch ( RuntimeException e ) { // Unchecked exceptions thrown here can be swallowed by Failsafe
// This catch ensures we at least get an FFDC
throw e ; } |
public class ScreenField { /** * Move the HTML input to the screen record fields .
* @ param strSuffix Only move fields with the suffix .
* @ return true if one was moved .
* @ exception DBException File exception . */
public int setSFieldToProperty ( String strSuffix , boolean bDisplayOption , int iMoveMode ) { } } | int iErrorCode = Constant . NORMAL_RETURN ; if ( this . isInputField ( ) ) { String strFieldName = this . getSFieldParam ( strSuffix ) ; String strParamValue = this . getSFieldProperty ( strFieldName ) ; if ( strParamValue != null ) iErrorCode = this . setSFieldValue ( strParamValue , bDisplayOption , iMoveMode ) ; } return iErrorCode ; |
public class NeedlessMemberCollectionSynchronization { /** * implements the visitor to clear the collectionFields and stack and to report collections that remain unmodified out of clinit or init
* @ param classContext
* the context object of the currently parsed class */
@ Override public void visitClassContext ( ClassContext classContext ) { } } | try { if ( ( collectionClass != null ) && ( mapClass != null ) ) { collectionFields = new HashMap < > ( ) ; aliases = new HashMap < > ( ) ; stack = new OpcodeStack ( ) ; JavaClass cls = classContext . getJavaClass ( ) ; className = cls . getClassName ( ) ; super . visitClassContext ( classContext ) ; for ( FieldInfo fi : collectionFields . values ( ) ) { if ( fi . isSynchronized ( ) ) { bugReporter . reportBug ( new BugInstance ( this , BugType . NMCS_NEEDLESS_MEMBER_COLLECTION_SYNCHRONIZATION . name ( ) , NORMAL_PRIORITY ) . addClass ( this ) . addField ( fi . getFieldAnnotation ( ) ) ) ; } } } } finally { collectionFields = null ; aliases = null ; stack = null ; } |
public class BasicContainer { /** * Add < code > box < / code > to the container and sets the parent correctly . If < code > box < / code > is < code > null < / code >
* nochange will be performed and no error thrown .
* @ param box will be added to the container */
public void addBox ( Box box ) { } } | if ( box != null ) { boxes = new ArrayList < Box > ( getBoxes ( ) ) ; boxes . add ( box ) ; } |
public class BasePanel { /** * Display this screen in html input format .
* @ return true if default params were found for this form .
* @ param out The http output stream .
* @ exception DBException File exception . */
public boolean printControl ( PrintWriter out , int iPrintOptions ) { } } | boolean bFieldsFound = super . printControl ( out , iPrintOptions ) ; if ( ! bFieldsFound ) { int iNumCols = this . getSFieldCount ( ) ; for ( int iIndex = 0 ; iIndex < iNumCols ; iIndex ++ ) { ScreenField sField = this . getSField ( iIndex ) ; boolean bPrintControl = this . isPrintableControl ( sField , iPrintOptions ) ; if ( this . isToolbar ( ) ) if ( sField . getConverter ( ) == null ) bPrintControl = false ; if ( this instanceof BaseGridScreen ) if ( iIndex < ( ( BaseGridScreen ) this ) . getNavCount ( ) ) bPrintControl = true ; // Move to isPrintable .
if ( bPrintControl ) { if ( ! bFieldsFound ) this . printControlStartForm ( out , iPrintOptions ) ; // First time
this . printControlStartField ( out , iPrintOptions ) ; sField . printControl ( out , iPrintOptions ) ; this . printControlEndField ( out , iPrintOptions ) ; bFieldsFound = true ; } } if ( bFieldsFound ) this . printControlEndForm ( out , iPrintOptions ) ; } return bFieldsFound ; |
public class CreateVM { /** * Connects to a specified data center and creates a virtual machine using the inputs provided .
* @ param host VMware host or IP - Example : " vc6 . subdomain . example . com "
* @ param port optional - the port to connect through - Examples : " 443 " , " 80 " - Default : " 443"
* @ param protocol optional - the connection protocol - Valid : " http " , " https " - Default : " https "
* @ param username the VMware username use to connect
* @ param password the password associated with " username " input
* @ param trustEveryone optional - if " true " will allow connections from any host , if " false " the connection will
* be allowed only using a valid vCenter certificate - Default : " true "
* Check the : https : / / pubs . vmware . com / vsphere - 50 / index . jsp ? topic = % 2Fcom . vmware . wssdk . dsg . doc _ 50%2Fsdk _ java _ development . 4.3 . html
* to see how to import a certificate into Java Keystore and
* https : / / pubs . vmware . com / vsphere - 50 / index . jsp ? topic = % 2Fcom . vmware . wssdk . dsg . doc _ 50%2Fsdk _ sg _ server _ certificate _ Appendix . 6.4 . html
* to see how to obtain a valid vCenter certificate
* @ param closeSession Whether to use the flow session context to cache the Connection to the host or not . If set to
* " false " it will close and remove any connection from the session context , otherwise the Connection
* will be kept alive and not removed .
* Valid values : " true " , " false "
* Default value : " true "
* @ param dataCenterName the data center name where the host system is - Example : ' DataCenter2'
* @ param hostname the name of the target host to be queried to retrieve the supported guest OSes
* - Example : " host123 . subdomain . example . com "
* @ param virtualMachineName the name of the virtual machine that will be created
* @ param dataStore the datastore where the disk of the new created virtual machine will reside
* - Example : " datastore2 - vc6-1"
* @ param guestOsId the operating system associated with the new created virtual machine . The value for this
* input can be obtained by running GetOSDescriptors operation - Examples : " winXPProGuest " ,
* " win95Guest " , " centosGuest " , " fedoraGuest " , " freebsd64Guest " . . . etc .
* @ param folderName : optional - name of the folder where the virtual machine will be created . If not
* provided then the top parent folder will be used - Default : " "
* @ param resourcePool : optional - the resource pool for the cloned virtual machine . If not provided then the
* parent resource pool be will be used - Default : " "
* @ param description optional - the description of the virtual machine that will be created - Default : " "
* @ param numCPUs optional - the number that indicates how many processors will have the virtual machine
* that will be created - Default : " 1"
* @ param vmDiskSize optional - the disk capacity amount ( in Mb ) attached to the virtual machine that will
* be created - Default : " 1024"
* @ param vmMemorySize optional - the memory amount ( in Mb ) attached to the virtual machine that will will
* be created - Default : " 1024"
* @ return resultMap with String as key and value that contains returnCode of the operation , success message with
* task id of the execution or failure message and the exception if there is one */
@ Action ( name = "Create Virtual Machine" , outputs = { } } | @ Output ( Outputs . RETURN_CODE ) , @ Output ( Outputs . RETURN_RESULT ) , @ Output ( Outputs . EXCEPTION ) } , responses = { @ Response ( text = Outputs . SUCCESS , field = Outputs . RETURN_CODE , value = Outputs . RETURN_CODE_SUCCESS , matchType = MatchType . COMPARE_EQUAL , responseType = ResponseType . RESOLVED ) , @ Response ( text = Outputs . FAILURE , field = Outputs . RETURN_CODE , value = Outputs . RETURN_CODE_FAILURE , matchType = MatchType . COMPARE_EQUAL , responseType = ResponseType . ERROR , isOnFail = true ) } ) public Map < String , String > createVM ( @ Param ( value = HOST , required = true ) String host , @ Param ( value = PORT ) String port , @ Param ( value = PROTOCOL ) String protocol , @ Param ( value = USERNAME , required = true ) String username , @ Param ( value = PASSWORD , encrypted = true ) String password , @ Param ( value = TRUST_EVERYONE ) String trustEveryone , @ Param ( value = CLOSE_SESSION ) String closeSession , @ Param ( value = DATA_CENTER_NAME , required = true ) String dataCenterName , @ Param ( value = HOSTNAME , required = true ) String hostname , @ Param ( value = VM_NAME , required = true ) String virtualMachineName , @ Param ( value = DATA_STORE , required = true ) String dataStore , @ Param ( value = GUEST_OS_ID , required = true ) String guestOsId , @ Param ( value = FOLDER_NAME ) String folderName , @ Param ( value = RESOURCE_POOL ) String resourcePool , @ Param ( value = VM_DESCRIPTION ) String description , @ Param ( value = VM_CPU_COUNT ) String numCPUs , @ Param ( value = VM_DISK_SIZE ) String vmDiskSize , @ Param ( value = VM_MEMORY_SIZE ) String vmMemorySize , @ Param ( value = VMWARE_GLOBAL_SESSION_OBJECT ) GlobalSessionObject < Map < String , Connection > > globalSessionObject ) { try { final HttpInputs httpInputs = new HttpInputs . HttpInputsBuilder ( ) . withHost ( host ) . withPort ( port ) . withProtocol ( protocol ) . withUsername ( username ) . withPassword ( password ) . withTrustEveryone ( defaultIfEmpty ( trustEveryone , FALSE ) ) . withCloseSession ( defaultIfEmpty ( closeSession , TRUE ) ) . withGlobalSessionObject ( globalSessionObject ) . build ( ) ; final VmInputs vmInputs = new VmInputs . VmInputsBuilder ( ) . withDataCenterName ( dataCenterName ) . withHostname ( hostname ) . withVirtualMachineName ( virtualMachineName ) . withDescription ( description ) . withDataStore ( dataStore ) . withGuestOsId ( guestOsId ) . withFolderName ( folderName ) . withResourcePool ( resourcePool ) . withDescription ( description ) . withGuestOsId ( guestOsId ) . withDescription ( description ) . withIntNumCPUs ( numCPUs ) . withLongVmDiskSize ( vmDiskSize ) . withLongVmMemorySize ( vmMemorySize ) . build ( ) ; return new VmService ( ) . createVM ( httpInputs , vmInputs ) ; } catch ( Exception ex ) { return OutputUtilities . getFailureResultsMap ( ex ) ; } |
public class SessionSecurityManager { /** * INSTANCE SCOPE = = = = = */
@ Override public User getCurrentUser ( ) { } } | HttpSession session = getRequest ( ) . getSession ( false ) ; if ( session == null ) return null ; return ( User ) session . getAttribute ( SESSION_ATTR_USER ) ; |
public class WsMessageReaderImpl { /** * not part of the public API . */
public void close ( ) throws IOException { } } | if ( isClosed ( ) ) { return ; } if ( ! _webSocket . isDisconnected ( ) ) { String s = "Can't close the MessageReader if the WebSocket is " + "still connected" ; throw new WebSocketException ( s ) ; } _sharedQueue . done ( ) ; _closed = true ; |
public class Collections { /** * Returns an immutable list consisting of < tt > n < / tt > copies of the
* specified object . The newly allocated data object is tiny ( it contains
* a single reference to the data object ) . This method is useful in
* combination with the < tt > List . addAll < / tt > method to grow lists .
* The returned list is serializable .
* @ param < T > the class of the object to copy and of the objects
* in the returned list .
* @ param n the number of elements in the returned list .
* @ param o the element to appear repeatedly in the returned list .
* @ return an immutable list consisting of < tt > n < / tt > copies of the
* specified object .
* @ throws IllegalArgumentException if { @ code n < 0}
* @ see List # addAll ( Collection )
* @ see List # addAll ( int , Collection ) */
public static < T > List < T > nCopies ( int n , T o ) { } } | if ( n < 0 ) throw new IllegalArgumentException ( "List length = " + n ) ; return new CopiesList < > ( n , o ) ; |
public class ClientEnvironment { /** * Get the async . task manager singleton instance
* @ return the manager instance
* @ throws JMSException */
public static synchronized AsyncTaskManager getAsyncTaskManager ( ) throws JMSException { } } | if ( asyncTaskManager == null ) { int threadPoolMinSize = getSettings ( ) . getIntProperty ( FFMQCoreSettings . ASYNC_TASK_MANAGER_DELIVERY_THREAD_POOL_MINSIZE , 0 ) ; int threadPoolMaxIdle = getSettings ( ) . getIntProperty ( FFMQCoreSettings . ASYNC_TASK_MANAGER_DELIVERY_THREAD_POOL_MAXIDLE , 5 ) ; int threadPoolMaxSize = getSettings ( ) . getIntProperty ( FFMQCoreSettings . ASYNC_TASK_MANAGER_DELIVERY_THREAD_POOL_MAXSIZE , 10 ) ; asyncTaskManager = new AsyncTaskManager ( "AsyncTaskManager-client-delivery" , threadPoolMinSize , threadPoolMaxIdle , threadPoolMaxSize ) ; } return asyncTaskManager ; |
public class NotFoundHandler { public void handle ( String pathInContext , String pathParams , HttpRequest request , HttpResponse response ) throws HttpException , IOException { } } | log . debug ( "Not Found" ) ; String method = request . getMethod ( ) ; // Not found requests .
if ( method . equals ( HttpRequest . __GET ) || method . equals ( HttpRequest . __HEAD ) || method . equals ( HttpRequest . __POST ) || method . equals ( HttpRequest . __PUT ) || method . equals ( HttpRequest . __DELETE ) || method . equals ( HttpRequest . __MOVE ) ) { response . sendError ( HttpResponse . __404_Not_Found , request . getPath ( ) + " Not Found" ) ; } else if ( method . equals ( HttpRequest . __OPTIONS ) ) { // Handle OPTIONS request for entire server
if ( "*" . equals ( request . getPath ( ) ) ) { // 9.2
response . setIntField ( HttpFields . __ContentLength , 0 ) ; response . setField ( HttpFields . __Allow , "GET, HEAD, POST, PUT, DELETE, MOVE, OPTIONS, TRACE" ) ; response . commit ( ) ; } else response . sendError ( HttpResponse . __404_Not_Found ) ; } else if ( method . equals ( HttpRequest . __TRACE ) ) { handleTrace ( request , response ) ; } else { // Unknown METHOD
response . setField ( HttpFields . __Allow , "GET, HEAD, POST, PUT, DELETE, MOVE, OPTIONS, TRACE" ) ; response . sendError ( HttpResponse . __405_Method_Not_Allowed ) ; } |
public class ImageRenderer { /** * Renders the viewport using an SVGRenderer to the given output writer .
* @ param vp
* @ param out
* @ throws IOException */
protected void writeSVG ( Viewport vp , Writer out ) throws IOException { } } | // obtain the viewport bounds depending on whether we are clipping to viewport size or using the whole page
int w = vp . getClippedContentBounds ( ) . width ; int h = vp . getClippedContentBounds ( ) . height ; SVGRenderer render = new SVGRenderer ( w , h , out ) ; vp . draw ( render ) ; render . close ( ) ; |
public class SuperCfTemplate { /** * Query super columns using the provided predicate instead of the internal one
* @ param key
* @ param predicate
* @ return */
public SuperCfResult < K , SN , N > querySuperColumns ( K key , HSlicePredicate < SN > predicate ) { } } | return doExecuteSlice ( key , null , predicate ) ; |
public class JarWithFile { /** * Returns the dependency . */
private JarDepend getJarDepend ( ) { } } | if ( _depend == null || _depend . isModified ( ) ) _depend = new JarDepend ( new Depend ( getBacking ( ) ) ) ; return _depend ; |
public class MvcFragment { /** * This Android lifecycle callback is sealed . { @ link MvcFragment } will always use the
* layout returned by { @ link # getLayoutResId ( ) } to inflate the view . Instead , do actions to
* prepare views in { @ link # onViewReady ( View , Bundle , Reason ) } where all injected dependencies
* and all restored state will be ready to use .
* @ param inflater The inflater
* @ param container The container
* @ param savedInstanceState The savedInstanceState
* @ return The view for the fragment */
@ Override final public View onCreateView ( LayoutInflater inflater , ViewGroup container , Bundle savedInstanceState ) { } } | injectDependencies ( ) ; return inflater . inflate ( getLayoutResId ( ) , container , false ) ; |
public class AbstractMapView { /** * ( non - Javadoc )
* @ see com . ibm . ws . objectManager . Map # get ( java . lang . Object , com . ibm . ws . objectManager . Transaction ) */
public Token get ( Object key , Transaction transaction ) throws ObjectManagerException { } } | try { for ( Iterator iterator = entrySet ( ) . iterator ( ) ; ; ) { Entry entry = ( Entry ) iterator . next ( transaction ) ; Object entryKey = entry . getKey ( ) ; if ( key == entryKey || key . equals ( entryKey ) ) { return entry . getValue ( ) ; } } } catch ( java . util . NoSuchElementException exception ) { // No FFDC code needed , just exited search .
return null ; } // try . |
public class QStringValue { /** * { @ inheritDoc } */
@ Override public QStringValue prepare ( final AbstractTypeQuery _query , final AbstractQPart _part ) throws EFapsException { } } | if ( _part instanceof AbstractQAttrCompare ) { if ( ( ( AbstractQAttrCompare ) _part ) . isIgnoreCase ( ) ) { this . value = this . value . toUpperCase ( Context . getThreadContext ( ) . getLocale ( ) ) ; } if ( _part instanceof QMatch ) { this . value = Context . getDbType ( ) . prepare4Match ( this . value ) ; } if ( _part instanceof QEqual && ( ( QEqual ) _part ) . getAttribute ( ) . getAttribute ( ) != null ) { // check if the string is an status key and must be converted in
// a long
if ( ( ( QEqual ) _part ) . getAttribute ( ) . getAttribute ( ) . getParent ( ) . isCheckStatus ( ) && ( ( QEqual ) _part ) . getAttribute ( ) . getAttribute ( ) . equals ( ( ( QEqual ) _part ) . getAttribute ( ) . getAttribute ( ) . getParent ( ) . getStatusAttribute ( ) ) ) { final Status status ; if ( StringUtils . isNumeric ( this . value ) ) { status = Status . get ( Long . valueOf ( this . value ) ) ; } else { status = Status . find ( ( ( QEqual ) _part ) . getAttribute ( ) . getAttribute ( ) . getLink ( ) . getUUID ( ) , this . value ) ; } if ( status != null ) { this . value = Long . valueOf ( status . getId ( ) ) . toString ( ) ; this . noEscape = true ; } // check if the string is an oid and must be converted in a long
} else if ( ( ( QEqual ) _part ) . getAttribute ( ) . getAttribute ( ) . hasLink ( ) ) { final Instance insTmp = Instance . get ( this . value ) ; if ( insTmp . isValid ( ) ) { this . value = Long . valueOf ( insTmp . getId ( ) ) . toString ( ) ; this . noEscape = true ; } } } } return this ; |
public class CreateDurableSubscriberQuery { /** * / * ( non - Javadoc )
* @ see net . timewalker . ffmq4 . network . packet . AbstractPacket # unserializeFrom ( net . timewalker . ffmq4 . utils . RawDataInputStream ) */
@ Override protected void unserializeFrom ( RawDataBuffer in ) { } } | super . unserializeFrom ( in ) ; consumerId = new IntegerID ( in . readInt ( ) ) ; topic = ( Topic ) DestinationSerializer . unserializeFrom ( in ) ; messageSelector = in . readNullableUTF ( ) ; noLocal = in . readBoolean ( ) ; name = in . readUTF ( ) ; |
public class Cell { /** * Sets the minWidth , prefWidth , maxWidth , minHeight , prefHeight , and maxHeight to the specified values . */
public Cell < C , T > size ( float width , float height ) { } } | size ( new FixedValue < C , T > ( layout . toolkit , width ) , new FixedValue < C , T > ( layout . toolkit , height ) ) ; return this ; |
public class WekaToSamoaInstanceConverter { /** * Get Samoa attribute from a weka attribute .
* @ param index the index
* @ param attribute the attribute
* @ return the attribute */
protected Attribute samoaAttribute ( int index , weka . core . Attribute attribute ) { } } | Attribute samoaAttribute ; if ( attribute . isNominal ( ) ) { Enumeration enu = attribute . enumerateValues ( ) ; List < String > attributeValues = new ArrayList < String > ( ) ; while ( enu . hasMoreElements ( ) ) { attributeValues . add ( ( String ) enu . nextElement ( ) ) ; } samoaAttribute = new Attribute ( attribute . name ( ) , attributeValues ) ; } else { samoaAttribute = new Attribute ( attribute . name ( ) ) ; } return samoaAttribute ; |
public class StrTokenizer { /** * Checks if the characters at the index specified match the quote
* already matched in readNextToken ( ) .
* @ param srcChars the character array being tokenized
* @ param pos the position to check for a quote
* @ param len the length of the character array being tokenized
* @ param quoteStart the start position of the matched quote , 0 if no quoting
* @ param quoteLen the length of the matched quote , 0 if no quoting
* @ return true if a quote is matched */
private boolean isQuote ( final char [ ] srcChars , final int pos , final int len , final int quoteStart , final int quoteLen ) { } } | for ( int i = 0 ; i < quoteLen ; i ++ ) { if ( pos + i >= len || srcChars [ pos + i ] != srcChars [ quoteStart + i ] ) { return false ; } } return true ; |
public class ConnectionFactory { /** * Return a { @ link HttpURLConnection } that writes gets attribution information from { @ code
* https : / / mobile - service . segment . com / attribution } . */
public HttpURLConnection attribution ( String writeKey ) throws IOException { } } | HttpURLConnection connection = openConnection ( "https://mobile-service.segment.com/v1/attribution" ) ; connection . setRequestProperty ( "Authorization" , authorizationHeader ( writeKey ) ) ; connection . setRequestMethod ( "POST" ) ; connection . setDoOutput ( true ) ; return connection ; |
public class ByteArrayWrapper { /** * { @ inheritDoc } */
public synchronized int read ( long position , byte [ ] buffer , int offset , int length ) throws IOException { } } | long oldPos = getPos ( ) ; int nread = - 1 ; try { seek ( position ) ; nread = read ( buffer , offset , length ) ; } finally { seek ( oldPos ) ; } return nread ; |
public class CDIJSFInitializerImpl { /** * { @ inheritDoc } */
@ Override public void initializeCDIJSFViewHandler ( Application application ) { } } | CDIService cdiService = cdiServiceRef . getService ( ) ; if ( cdiService != null ) { BeanManager beanManager = cdiService . getCurrentBeanManager ( ) ; if ( beanManager != null ) { application . addELContextListener ( new WeldELContextListener ( ) ) ; CDIRuntime cdiRuntime = ( CDIRuntime ) cdiService ; String contextID = cdiRuntime . getCurrentApplicationContextID ( ) ; application . setViewHandler ( new IBMViewHandler ( application . getViewHandler ( ) , contextID ) ) ; } } |
public class ApplicationDialog { /** * Returns the parent window based on the internal parent Component . Will
* search for a Window in the parent hierarchy if needed ( when parent
* Component isn ' t a Window ) .
* @ return the parent window */
public Window getParentWindow ( ) { } } | if ( parentWindow == null ) { if ( ( parentComponent == null ) && ( getApplicationConfig ( ) . windowManager ( ) . getActiveWindow ( ) != null ) ) { parentWindow = getApplicationConfig ( ) . windowManager ( ) . getActiveWindow ( ) . getControl ( ) ; } else { parentWindow = getWindowForComponent ( parentComponent ) ; } } return parentWindow ; |
public class NorthArrowGraphic { /** * Embeds the given SVG element into a new SVG element scaling the graphic to the given dimension and
* applying the given rotation . */
private static void embedSvgGraphic ( final SVGElement svgRoot , final SVGElement newSvgRoot , final Document newDocument , final Dimension targetSize , final Double rotation ) { } } | final String originalWidth = svgRoot . getAttributeNS ( null , "width" ) ; final String originalHeight = svgRoot . getAttributeNS ( null , "height" ) ; /* * To scale the SVG graphic and to apply the rotation , we distinguish two
* cases : width and height is set on the original SVG or not .
* Case 1 : Width and height is set
* If width and height is set , we wrap the original SVG into 2 new SVG elements
* and a container element .
* Example :
* Original SVG :
* < svg width = " 100 " height = " 100 " > < / svg >
* New SVG ( scaled to 300x300 and rotated by 90 degree ) :
* < svg width = " 300 " height = " 300 " >
* < g transform = " rotate ( 90.0 150 150 ) " >
* < svg width = " 100 % " height = " 100 % " viewBox = " 0 0 100 100 " >
* < svg width = " 100 " height = " 100 " > < / svg >
* < / svg >
* < / svg >
* The requested size is set on the outermost < svg > . Then , the rotation is applied to the
* < g > container and the scaling is achieved with the viewBox parameter on the 2nd < svg > .
* Case 2 : Width and height is not set
* In this case the original SVG is wrapped into just one container and one new SVG element .
* The rotation is set on the container , and the scaling happens automatically .
* Example :
* Original SVG :
* < svg viewBox = " 0 0 61.06 91.83 " > < / svg >
* New SVG ( scaled to 300x300 and rotated by 90 degree ) :
* < svg width = " 300 " height = " 300 " >
* < g transform = " rotate ( 90.0 150 150 ) " >
* < svg viewBox = " 0 0 61.06 91.83 " > < / svg >
* < / svg > */
if ( ! StringUtils . isEmpty ( originalWidth ) && ! StringUtils . isEmpty ( originalHeight ) ) { Element wrapperContainer = newDocument . createElementNS ( SVG_NS , "g" ) ; wrapperContainer . setAttributeNS ( null , SVGConstants . SVG_TRANSFORM_ATTRIBUTE , getRotateTransformation ( targetSize , rotation ) ) ; newSvgRoot . appendChild ( wrapperContainer ) ; Element wrapperSvg = newDocument . createElementNS ( SVG_NS , "svg" ) ; wrapperSvg . setAttributeNS ( null , "width" , "100%" ) ; wrapperSvg . setAttributeNS ( null , "height" , "100%" ) ; wrapperSvg . setAttributeNS ( null , "viewBox" , "0 0 " + originalWidth + " " + originalHeight ) ; wrapperContainer . appendChild ( wrapperSvg ) ; Node svgRootImported = newDocument . importNode ( svgRoot , true ) ; wrapperSvg . appendChild ( svgRootImported ) ; } else if ( StringUtils . isEmpty ( originalWidth ) && StringUtils . isEmpty ( originalHeight ) ) { Element wrapperContainer = newDocument . createElementNS ( SVG_NS , "g" ) ; wrapperContainer . setAttributeNS ( null , SVGConstants . SVG_TRANSFORM_ATTRIBUTE , getRotateTransformation ( targetSize , rotation ) ) ; newSvgRoot . appendChild ( wrapperContainer ) ; Node svgRootImported = newDocument . importNode ( svgRoot , true ) ; wrapperContainer . appendChild ( svgRootImported ) ; } else { throw new IllegalArgumentException ( "Unsupported or invalid north-arrow SVG graphic: The same unit (px, em, %, ...) must be" + " " + "used for `width` and `height`." ) ; } |
public class SignatureUtil { /** * 生成事件消息接收签名
* @ param token token
* @ param timestamp timestamp
* @ param nonce nonce
* @ return str */
public static String generateEventMessageSignature ( String token , String timestamp , String nonce ) { } } | String [ ] array = new String [ ] { token , timestamp , nonce } ; Arrays . sort ( array ) ; String s = StringUtils . arrayToDelimitedString ( array , "" ) ; return DigestUtils . shaHex ( s ) ; |
public class IntTupleIterables { /** * Returns an iterable returning an iterator that returns
* { @ link MutableIntTuple } s in the specified range , in
* lexicographical order . < br >
* < br >
* Copies of the given tuples will be stored internally . < br >
* < br >
* Also see < a href = " . . / . . / package - summary . html # IterationOrder " >
* Iteration Order < / a >
* @ param min The minimum values , inclusive
* @ param max The maximum values , exclusive
* @ return The iterable
* @ throws IllegalArgumentException If the given tuples do not
* have the same { @ link Tuple # getSize ( ) size } */
public static Iterable < MutableIntTuple > lexicographicalIterable ( IntTuple min , IntTuple max ) { } } | return iterable ( Order . LEXICOGRAPHICAL , min , max ) ; |
public class ListExtensions { /** * Provides a reverse view on the given list which is especially useful to traverse a list backwards in a for - each
* loop . The list itself is not modified by calling this method .
* @ param list
* the list whose elements should be traversed in reverse . May not be < code > null < / code > .
* @ return a list with the same elements as the given list , in reverse */
@ Pure public static < T > List < T > reverseView ( List < T > list ) { } } | return Lists . reverse ( list ) ; |
public class DescribeAssociationExecutionsResult { /** * A list of the executions for the specified association ID .
* @ param associationExecutions
* A list of the executions for the specified association ID . */
public void setAssociationExecutions ( java . util . Collection < AssociationExecution > associationExecutions ) { } } | if ( associationExecutions == null ) { this . associationExecutions = null ; return ; } this . associationExecutions = new com . amazonaws . internal . SdkInternalList < AssociationExecution > ( associationExecutions ) ; |
public class JShellToolBuilder { /** * Set the output channels . Same as { @ code out ( output , output , output ) } .
* Default , if not set , { @ code out ( System . out ) } .
* @ param output destination of command feedback , console interaction , and
* user code output
* @ return the { @ code JavaShellToolBuilder } instance */
@ Override public JavaShellToolBuilder out ( PrintStream output ) { } } | this . cmdOut = output ; this . console = output ; this . userOut = output ; return this ; |
public class ClassDescriptor { /** * Specify the method to instantiate objects
* represented by this descriptor .
* @ see # setFactoryClass */
private synchronized void setFactoryMethod ( Method newMethod ) { } } | if ( newMethod != null ) { // make sure it ' s a no argument method
if ( newMethod . getParameterTypes ( ) . length > 0 ) { throw new MetadataException ( "Factory methods must be zero argument methods: " + newMethod . getClass ( ) . getName ( ) + "." + newMethod . getName ( ) ) ; } // make it accessible if it ' s not already
if ( ! newMethod . isAccessible ( ) ) { newMethod . setAccessible ( true ) ; } } this . factoryMethod = newMethod ; |
public class Counters { /** * Convert a counters object into a single line that is easy to parse .
* @ return the string with " name = value " for each counter and separated by " , " */
public synchronized String makeCompactString ( ) { } } | StringBuffer buffer = new StringBuffer ( ) ; boolean first = true ; for ( Group group : this ) { for ( Counter counter : group ) { if ( first ) { first = false ; } else { buffer . append ( ',' ) ; } buffer . append ( group . getDisplayName ( ) ) ; buffer . append ( '.' ) ; buffer . append ( counter . getDisplayName ( ) ) ; buffer . append ( ':' ) ; buffer . append ( counter . getCounter ( ) ) ; } } return buffer . toString ( ) ; |
public class WordTree { /** * 添加单词 , 使用默认类型
* @ param word 单词 */
public void addWord ( String word ) { } } | WordTree parent = null ; WordTree current = this ; WordTree child ; char currentChar = 0 ; int length = word . length ( ) ; for ( int i = 0 ; i < length ; i ++ ) { currentChar = word . charAt ( i ) ; if ( false == StopChar . isStopChar ( currentChar ) ) { // 只处理合法字符
child = current . get ( currentChar ) ; if ( child == null ) { // 无子类 , 新建一个子节点后存放下一个字符
child = new WordTree ( ) ; current . put ( currentChar , child ) ; } parent = current ; current = child ; } } if ( null != parent ) { parent . setEnd ( currentChar ) ; } |
public class InstanceStateManager { /** * Restoring instance state from given { @ code savedState } into the given { @ code obj } .
* < br / >
* Supposed to be called from { @ link android . app . Activity # onCreate ( android . os . Bundle ) } or
* { @ link android . app . Fragment # onCreate ( android . os . Bundle ) } before starting using local fields
* marked with { @ link InstanceState } annotation . */
public static < T > void restoreInstanceState ( @ NonNull T obj , @ Nullable Bundle savedState ) { } } | if ( savedState != null ) { new InstanceStateManager < > ( obj ) . restoreState ( savedState ) ; } |
public class BackedStore { /** * PK68691
* removeFromMemory
* Removes session from Memory if persistence is enabled , otherwise no op
* @ see com . ibm . wsspi . session . IStore # removeFromMemory ( java . lang . String ) */
public void removeFromMemory ( String id ) { } } | final boolean isTraceOn = com . ibm . websphere . ras . TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && LoggingUtil . SESSION_LOGGER_WAS . isLoggable ( Level . FINER ) ) { LoggingUtil . SESSION_LOGGER_WAS . entering ( methodClassName , methodNames [ REMOVE_FROM_MEMORY ] , id ) ; } BackedSession sess = ( BackedSession ) ( ( BackedHashMap ) _sessions ) . superGet ( id ) ; if ( sess != null ) { if ( com . ibm . websphere . ras . TraceComponent . isAnyTracingEnabled ( ) && LoggingUtil . SESSION_LOGGER_WAS . isLoggable ( Level . FINE ) ) LoggingUtil . SESSION_LOGGER_WAS . logp ( Level . FINE , methodClassName , methodNames [ REMOVE_FROM_MEMORY ] , "removing from memory" ) ; synchronized ( sess ) { BackedSession sess1 = ( BackedSession ) ( ( BackedHashMap ) _sessions ) . accessObject ( id ) ; if ( sess == sess1 ) { Object removedEntry = ( ( BackedHashMap ) _sessions ) . superRemove ( id ) ; if ( removedEntry != null ) { if ( com . ibm . websphere . ras . TraceComponent . isAnyTracingEnabled ( ) && LoggingUtil . SESSION_LOGGER_WAS . isLoggable ( Level . FINE ) ) LoggingUtil . SESSION_LOGGER_WAS . logp ( Level . FINE , methodClassName , methodNames [ REMOVE_FROM_MEMORY ] , "successfully removed from memory" ) ; } } } } if ( isTraceOn && LoggingUtil . SESSION_LOGGER_WAS . isLoggable ( Level . FINER ) ) LoggingUtil . SESSION_LOGGER_WAS . exiting ( methodClassName , methodNames [ REMOVE_FROM_MEMORY ] ) ; |
public class IndexHtmlDispatcher { /** * Returns a { @ link IndexHtmlDispatcher } if and only if the said class has { @ code index . html } as a side - file .
* @ param context
* @ param c Class from where to start the index . html inspection . Will go through class hierarchy ( unless interface )
* @ return Index dispatcher or { @ code null } if it cannot be found */
static Dispatcher make ( ServletContext context , Class c ) { } } | for ( ; c != null && c != Object . class ; c = c . getSuperclass ( ) ) { String name = "/WEB-INF/side-files/" + c . getName ( ) . replace ( '.' , '/' ) + "/index.html" ; try { URL url = context . getResource ( name ) ; if ( url != null ) return new IndexHtmlDispatcher ( url ) ; } catch ( MalformedURLException e ) { throw new IllegalArgumentException ( e ) ; } } return null ; |
public class AppsImpl { /** * Get the application settings .
* @ param appId The application ID .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the ApplicationSettings object */
public Observable < ServiceResponse < ApplicationSettings > > getSettingsWithServiceResponseAsync ( UUID appId ) { } } | if ( this . client . endpoint ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.endpoint() is required and cannot be null." ) ; } if ( appId == null ) { throw new IllegalArgumentException ( "Parameter appId is required and cannot be null." ) ; } String parameterizedHost = Joiner . on ( ", " ) . join ( "{Endpoint}" , this . client . endpoint ( ) ) ; return service . getSettings ( appId , this . client . acceptLanguage ( ) , parameterizedHost , this . client . userAgent ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < ServiceResponse < ApplicationSettings > > > ( ) { @ Override public Observable < ServiceResponse < ApplicationSettings > > call ( Response < ResponseBody > response ) { try { ServiceResponse < ApplicationSettings > clientResponse = getSettingsDelegate ( response ) ; return Observable . just ( clientResponse ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ; |
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link AbstractSolidType } { @ code > }
* @ param value
* Java instance representing xml element ' s value .
* @ return
* the new instance of { @ link JAXBElement } { @ code < } { @ link AbstractSolidType } { @ code > } */
@ XmlElementDecl ( namespace = "http://www.opengis.net/gml" , name = "_Solid" , substitutionHeadNamespace = "http://www.opengis.net/gml" , substitutionHeadName = "_GeometricPrimitive" ) public JAXBElement < AbstractSolidType > create_Solid ( AbstractSolidType value ) { } } | return new JAXBElement < AbstractSolidType > ( __Solid_QNAME , AbstractSolidType . class , null , value ) ; |
public class TinyLog { /** * 如果最后一个参数为异常参数 , 则获取之 , 否则返回null
* @ param arguments 参数
* @ return 最后一个异常参数
* @ since 4.0.3 */
private static Throwable getLastArgumentIfThrowable ( Object ... arguments ) { } } | if ( ArrayUtil . isNotEmpty ( arguments ) && arguments [ arguments . length - 1 ] instanceof Throwable ) { return ( Throwable ) arguments [ arguments . length - 1 ] ; } else { return null ; } |
public class CmsSearchFieldMapping { /** * Returns a " \ n " separated String of values for the given XPath if according content items can be found . < p >
* @ param contentItems the content items to get the value from
* @ param xpath the short XPath parameter to get the value for
* @ return a " \ n " separated String of element values found in the content items for the given XPath */
private String getContentItemForXPath ( Map < String , String > contentItems , String xpath ) { } } | if ( contentItems . get ( xpath ) != null ) { // content item found for XPath
return contentItems . get ( xpath ) ; } else { // try a multiple value mapping and ensure that the values are in correct order .
SortedMap < List < Integer > , String > valueMap = new TreeMap < > ( new Comparator < List < Integer > > ( ) { // expects lists of the same length that contain only non - null values . This is given for the use case .
@ SuppressWarnings ( "boxing" ) public int compare ( List < Integer > l1 , List < Integer > l2 ) { for ( int i = 0 ; i < l1 . size ( ) ; i ++ ) { int numCompare = Integer . compare ( l1 . get ( i ) , l2 . get ( i ) ) ; if ( 0 != numCompare ) { return numCompare ; } } return 0 ; } } ) ; for ( Map . Entry < String , String > entry : contentItems . entrySet ( ) ) { if ( CmsXmlUtils . removeXpath ( entry . getKey ( ) ) . equals ( xpath ) ) { // the removed path refers an item
String [ ] xPathParts = entry . getKey ( ) . split ( "/" ) ; List < Integer > indexes = new ArrayList < > ( xPathParts . length ) ; for ( String xPathPart : Arrays . asList ( xPathParts ) ) { if ( ! xPathPart . isEmpty ( ) ) { indexes . add ( Integer . valueOf ( CmsXmlUtils . getXpathIndexInt ( xPathPart ) ) ) ; } } valueMap . put ( indexes , entry . getValue ( ) ) ; } } StringBuffer result = new StringBuffer ( ) ; for ( String value : valueMap . values ( ) ) { result . append ( value ) ; result . append ( "\n" ) ; } return result . length ( ) > 1 ? result . toString ( ) . substring ( 0 , result . length ( ) - 1 ) : null ; } |
public class OWLIrreflexiveObjectPropertyAxiomImpl_CustomFieldSerializer { /** * Deserializes the content of the object from the
* { @ link com . google . gwt . user . client . rpc . SerializationStreamReader } .
* @ param streamReader the { @ link com . google . gwt . user . client . rpc . SerializationStreamReader } to read the
* object ' s content from
* @ param instance the object instance to deserialize
* @ throws com . google . gwt . user . client . rpc . SerializationException
* if the deserialization operation is not
* successful */
@ Override public void deserializeInstance ( SerializationStreamReader streamReader , OWLIrreflexiveObjectPropertyAxiomImpl instance ) throws SerializationException { } } | deserialize ( streamReader , instance ) ; |
public class GetListOfCategoriesRequest { /** * Get a paging of { @ link Category } objects .
* @ return A { @ link Category } paging .
* @ throws IOException In case of networking issues .
* @ throws SpotifyWebApiException The Web API returned an error further specified in this exception ' s root cause . */
@ SuppressWarnings ( "unchecked" ) public Paging < Category > execute ( ) throws IOException , SpotifyWebApiException { } } | return new Category . JsonUtil ( ) . createModelObjectPaging ( getJson ( ) , "categories" ) ; |
public class FileUtil { /** * 判断文件是否存在 , from Jodd .
* @ see { @ link Files # exists }
* @ see { @ link Files # isRegularFile } */
public static boolean isFileExists ( Path path ) { } } | if ( path == null ) { return false ; } return Files . exists ( path ) && Files . isRegularFile ( path ) ; |
public class ExtensionManager { /** * Notifies the extensions that the kernel is initialized */
public void initialized ( ) { } } | for ( KernelExtension kernelExtension : kernelExtensions . keySet ( ) ) { kernelExtension . initialized ( kernelExtensions . get ( kernelExtension ) ) ; } |
public class MetricRegistry { /** * Return the { @ link Timer } registered under this name ; or create and register
* a new { @ link Timer } using the provided MetricSupplier if none is registered .
* @ param name the name of the metric
* @ param supplier a MetricSupplier that can be used to manufacture a Timer
* @ return a new or pre - existing { @ link Timer } */
public Timer timer ( String name , final MetricSupplier < Timer > supplier ) { } } | return getOrAdd ( name , new MetricBuilder < Timer > ( ) { @ Override public Timer newMetric ( ) { return supplier . newMetric ( ) ; } @ Override public boolean isInstance ( Metric metric ) { return Timer . class . isInstance ( metric ) ; } } ) ; |
public class ReactiveHealthIndicatorRegistryFactory { /** * Create a { @ link ReactiveHealthIndicatorRegistry } based on the specified health
* indicators . Each { @ link HealthIndicator } are wrapped to a
* { @ link HealthIndicatorReactiveAdapter } . If two instances share the same name , the
* reactive variant takes precedence .
* @ param reactiveHealthIndicators the { @ link ReactiveHealthIndicator } instances
* mapped by name
* @ param healthIndicators the { @ link HealthIndicator } instances mapped by name if
* any .
* @ return a { @ link ReactiveHealthIndicator } that delegates to the specified
* { @ code reactiveHealthIndicators } . */
public ReactiveHealthIndicatorRegistry createReactiveHealthIndicatorRegistry ( Map < String , ReactiveHealthIndicator > reactiveHealthIndicators , Map < String , HealthIndicator > healthIndicators ) { } } | Assert . notNull ( reactiveHealthIndicators , "ReactiveHealthIndicators must not be null" ) ; return initialize ( new DefaultReactiveHealthIndicatorRegistry ( ) , reactiveHealthIndicators , healthIndicators ) ; |
public class Recurring { /** * Get the day in month of the current month of Calendar .
* @ param cal
* @ param dayOfWeek The day of week .
* @ param orderNum The order number , 0 mean the first , - 1 mean the last .
* @ return The day int month */
private static int getDay ( Calendar cal , int dayOfWeek , int orderNum ) { } } | int day = cal . getActualMaximum ( Calendar . DAY_OF_MONTH ) ; cal . set ( Calendar . DAY_OF_MONTH , day ) ; int lastWeekday = cal . get ( Calendar . DAY_OF_WEEK ) ; int shift = lastWeekday >= dayOfWeek ? ( lastWeekday - dayOfWeek ) : ( lastWeekday + 7 - dayOfWeek ) ; // find last dayOfWeek of this month
day -= shift ; if ( orderNum < 0 ) return day ; cal . set ( Calendar . DAY_OF_MONTH , day ) ; int lastOrderNum = ( cal . get ( Calendar . DAY_OF_MONTH ) - 1 ) / 7 ; if ( orderNum >= lastOrderNum ) return day ; return day - ( lastOrderNum - orderNum ) * 7 ; |
public class DirectoryHelper { /** * Compress data . In case when < code > rootPath < / code > is a directory this method
* compress all files and folders inside the directory into single one . IOException
* will be thrown if directory is empty . If the < code > rootPath < / code > is the file
* the only this file will be compressed .
* @ param rootPath
* the root path , can be the directory or the file
* @ param dstZipPath
* the path to the destination compressed file
* @ throws IOException
* if any exception occurred */
public static void compressDirectory ( File rootPath , File dstZipPath ) throws IOException { } } | ZipOutputStream zip = new ZipOutputStream ( new FileOutputStream ( dstZipPath ) ) ; try { if ( rootPath . isDirectory ( ) ) { String [ ] files = rootPath . list ( ) ; if ( files == null || files . length == 0 ) { // In java 7 no ZipException is thrown in case of an empty directory
// so to remain compatible we need to throw it explicitly
throw new ZipException ( "ZIP file must have at least one entry" ) ; } for ( int i = 0 ; i < files . length ; i ++ ) { compressDirectory ( "" , new File ( rootPath , files [ i ] ) , zip ) ; } } else { compressDirectory ( "" , rootPath , zip ) ; } } finally { if ( zip != null ) { zip . flush ( ) ; zip . close ( ) ; } } |
public class Http2ConnectionHandler { /** * Closes the connection if the graceful shutdown process has completed .
* @ param future Represents the status that will be passed to the { @ link # closeListener } . */
private void checkCloseConnection ( ChannelFuture future ) { } } | // If this connection is closing and the graceful shutdown has completed , close the connection
// once this operation completes .
if ( closeListener != null && isGracefulShutdownComplete ( ) ) { ChannelFutureListener closeListener = this . closeListener ; // This method could be called multiple times
// and we don ' t want to notify the closeListener multiple times .
this . closeListener = null ; try { closeListener . operationComplete ( future ) ; } catch ( Exception e ) { throw new IllegalStateException ( "Close listener threw an unexpected exception" , e ) ; } } |
public class ConfigArgP { /** * Performs sys - prop and js evals on the passed value
* @ param text The value to process
* @ return the processed value */
public static String processConfigValue ( CharSequence text ) { } } | final String pv = evaluate ( tokenReplaceSysProps ( text ) ) ; return ( pv == null || pv . trim ( ) . isEmpty ( ) ) ? null : pv ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.