signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class DumpProcessingController { /** * Registers an MwRevisionProcessor , which will henceforth be notified of
* all revisions that are encountered in the dump .
* This only is used when processing dumps that contain revisions . In
* particular , plain JSON dumps contain no revision information .
* Importantly , the { @ link MwRevision } that the registered processors will
* receive is valid only during the execution of
* { @ link MwRevisionProcessor # processRevision ( MwRevision ) } , but it will not
* be permanent . If the data is to be retained permanently , the revision
* processor needs to make its own copy .
* @ param mwRevisionProcessor
* the revision processor to register
* @ param model
* the content model that the processor is registered for ; it
* will only be notified of revisions in that model ; if null is
* given , all revisions will be processed whatever their model
* @ param onlyCurrentRevisions
* if true , then the subscriber is only notified of the most
* current revisions ; if false , then it will receive all
* revisions , current or not */
public void registerMwRevisionProcessor ( MwRevisionProcessor mwRevisionProcessor , String model , boolean onlyCurrentRevisions ) { } } | registerProcessor ( mwRevisionProcessor , model , onlyCurrentRevisions , this . mwRevisionProcessors ) ; |
public class GuacamoleWebSocketTunnelServlet { /** * Sends the given status on the given WebSocket connection
* and closes the connection .
* @ param connection
* The WebSocket connection to close .
* @ param guacStatus
* The status to send . */
private static void closeConnection ( Connection connection , GuacamoleStatus guacStatus ) { } } | closeConnection ( connection , guacStatus . getGuacamoleStatusCode ( ) , guacStatus . getWebSocketCode ( ) ) ; |
public class AbstractFormatter { /** * Is given object < i > empty < / i > ( null or empty string ) ? */
protected boolean isEmpty ( Object o ) { } } | if ( o == null ) { return true ; } else if ( o instanceof String ) { return ! StringUtils . hasText ( ( String ) o ) ; } else { return false ; } |
public class TransportResolver { /** * Initialize Transport Resolver and wait until it is completely uninitialized .
* @ throws SmackException
* @ throws InterruptedException */
public void initializeAndWait ( ) throws XMPPException , SmackException , InterruptedException { } } | this . initialize ( ) ; try { LOGGER . fine ( "Initializing transport resolver..." ) ; while ( ! this . isInitialized ( ) ) { LOGGER . fine ( "Resolver init still pending" ) ; Thread . sleep ( 1000 ) ; } LOGGER . fine ( "Transport resolved" ) ; } catch ( Exception e ) { LOGGER . log ( Level . WARNING , "exception" , e ) ; } |
public class EnhancedDebugger { /** * Adds the received stanza detail to the messages table .
* @ param dateFormatter the SimpleDateFormat to use to format Dates
* @ param packet the read stanza to add to the table */
private void addReadPacketToTable ( final SimpleDateFormat dateFormatter , final TopLevelStreamElement packet ) { } } | SwingUtilities . invokeLater ( new Runnable ( ) { @ Override public void run ( ) { String messageType ; Jid from ; String stanzaId ; if ( packet instanceof Stanza ) { Stanza stanza = ( Stanza ) packet ; from = stanza . getFrom ( ) ; stanzaId = stanza . getStanzaId ( ) ; } else { from = null ; stanzaId = "(Nonza)" ; } String type = "" ; Icon packetTypeIcon ; receivedPackets ++ ; if ( packet instanceof IQ ) { packetTypeIcon = iqPacketIcon ; messageType = "IQ Received (class=" + packet . getClass ( ) . getName ( ) + ")" ; type = ( ( IQ ) packet ) . getType ( ) . toString ( ) ; receivedIQPackets ++ ; } else if ( packet instanceof Message ) { packetTypeIcon = messagePacketIcon ; messageType = "Message Received" ; type = ( ( Message ) packet ) . getType ( ) . toString ( ) ; receivedMessagePackets ++ ; } else if ( packet instanceof Presence ) { packetTypeIcon = presencePacketIcon ; messageType = "Presence Received" ; type = ( ( Presence ) packet ) . getType ( ) . toString ( ) ; receivedPresencePackets ++ ; } else { packetTypeIcon = unknownPacketTypeIcon ; messageType = packet . getClass ( ) . getName ( ) + " Received" ; receivedOtherPackets ++ ; } // Check if we need to remove old rows from the table to keep memory consumption low
if ( EnhancedDebuggerWindow . MAX_TABLE_ROWS > 0 && messagesTable . getRowCount ( ) >= EnhancedDebuggerWindow . MAX_TABLE_ROWS ) { messagesTable . removeRow ( 0 ) ; } messagesTable . addRow ( new Object [ ] { XmlUtil . prettyFormatXml ( packet . toXML ( ) . toString ( ) ) , dateFormatter . format ( new Date ( ) ) , packetReceivedIcon , packetTypeIcon , messageType , stanzaId , type , "" , from } ) ; // Update the statistics table
updateStatistics ( ) ; } } ) ; |
public class PartOfSpeechTagDictionary { /** * 翻译词性
* @ param tag
* @ return */
public static String translate ( String tag ) { } } | String cn = translator . get ( tag ) ; if ( cn == null ) return tag ; return cn ; |
public class ReflectUtil { /** * Returns the setter - method for the given field name or null if no setter exists . */
public static Method getSetter ( String fieldName , Class < ? > clazz , Class < ? > fieldType ) { } } | String setterName = buildSetterName ( fieldName ) ; try { // Using getMathods ( ) , getMathod ( . . . ) expects exact parameter type
// matching and ignores inheritance - tree .
Method [ ] methods = clazz . getMethods ( ) ; for ( Method method : methods ) { if ( method . getName ( ) . equals ( setterName ) ) { Class < ? > [ ] paramTypes = method . getParameterTypes ( ) ; if ( paramTypes != null && paramTypes . length == 1 && paramTypes [ 0 ] . isAssignableFrom ( fieldType ) ) { return method ; } } } return null ; } catch ( SecurityException e ) { throw LOG . unableToAccessMethod ( setterName , clazz . getName ( ) ) ; } |
public class DefaultArtifactUtil { /** * { @ inheritDoc } */
public Set < Artifact > resolveTransitively ( Set < Artifact > jarResourceArtifacts , Set < MavenProject > siblingProjects , Artifact originateArtifact , ArtifactRepository localRepository , List < ArtifactRepository > remoteRepositories , ArtifactFilter artifactFilter , Map managedVersions ) throws MojoExecutionException { } } | Set < Artifact > resultArtifacts = new LinkedHashSet < > ( ) ; if ( CollectionUtils . isNotEmpty ( siblingProjects ) ) { // getting transitive dependencies from project
for ( MavenProject siblingProject : siblingProjects ) { Set < Artifact > artifacts = siblingProject . getArtifacts ( ) ; for ( Artifact artifact : artifacts ) { if ( artifactFilter . include ( artifact ) ) { resultArtifacts . add ( artifact ) ; } } } } try { ArtifactResolutionResult result = artifactResolver . resolveTransitively ( jarResourceArtifacts , originateArtifact , managedVersions , localRepository , remoteRepositories , this . artifactMetadataSource , artifactFilter ) ; resultArtifacts . addAll ( result . getArtifacts ( ) ) ; return resultArtifacts ; } catch ( ArtifactResolutionException e ) { throw new MojoExecutionException ( "Could not resolv transitive dependencies" , e ) ; } catch ( ArtifactNotFoundException e ) { throw new MojoExecutionException ( "Could not find transitive dependencies " , e ) ; } |
public class AbstractAgiServer { /** * Creates a new ThreadPoolExecutor to serve the AGI requests . The nature of
* this pool defines how many concurrent requests can be handled . The
* default implementation returns a dynamic thread pool defined by the
* poolSize and maximumPoolSize properties .
* You can override this method to change this behavior . For example you can
* use a cached pool with
* < pre >
* return Executors . newCachedThreadPool ( new DaemonThreadFactory ( ) ) ;
* < / pre >
* @ return the ThreadPoolExecutor to use for serving AGI requests .
* @ see # setPoolSize ( int )
* @ see # setMaximumPoolSize ( int ) */
protected ThreadPoolExecutor createPool ( ) { } } | return new ThreadPoolExecutor ( poolSize , ( maximumPoolSize < poolSize ) ? poolSize : maximumPoolSize , 50000L , TimeUnit . MILLISECONDS , new SynchronousQueue < Runnable > ( ) , new DaemonThreadFactory ( ) ) ; |
public class CassandraClientBase { /** * Sets the batch size .
* @ param persistenceUnit
* the persistence unit
* @ param puProperties
* the pu properties */
private void setBatchSize ( String persistenceUnit , Map < String , Object > puProperties ) { } } | String batch_Size = null ; PersistenceUnitMetadata puMetadata = KunderaMetadataManager . getPersistenceUnitMetadata ( kunderaMetadata , persistenceUnit ) ; String externalBatchSize = puProperties != null ? ( String ) puProperties . get ( PersistenceProperties . KUNDERA_BATCH_SIZE ) : null ; Integer intbatch = null ; if ( puMetadata . getBatchSize ( ) > 0 ) { intbatch = new Integer ( puMetadata . getBatchSize ( ) ) ; } batch_Size = ( String ) ( externalBatchSize != null ? externalBatchSize : intbatch != null ? intbatch . toString ( ) : null ) ; setBatchSize ( batch_Size ) ; |
public class CharStreams { /** * Copies all characters between the { @ link Readable } and { @ link Appendable } objects . Does not
* close or flush either object .
* @ param from the object to read from
* @ param to the object to write to
* @ return the number of characters copied
* @ throws IOException if an I / O error occurs */
@ CanIgnoreReturnValue public static long copy ( Readable from , Appendable to ) throws IOException { } } | checkNotNull ( from ) ; checkNotNull ( to ) ; CharBuffer buf = createBuffer ( ) ; long total = 0 ; while ( from . read ( buf ) != - 1 ) { buf . flip ( ) ; to . append ( buf ) ; total += buf . remaining ( ) ; buf . clear ( ) ; } return total ; |
public class NetworkProfileMarshaller { /** * Marshall the given parameter object . */
public void marshall ( NetworkProfile networkProfile , ProtocolMarshaller protocolMarshaller ) { } } | if ( networkProfile == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( networkProfile . getArn ( ) , ARN_BINDING ) ; protocolMarshaller . marshall ( networkProfile . getName ( ) , NAME_BINDING ) ; protocolMarshaller . marshall ( networkProfile . getDescription ( ) , DESCRIPTION_BINDING ) ; protocolMarshaller . marshall ( networkProfile . getType ( ) , TYPE_BINDING ) ; protocolMarshaller . marshall ( networkProfile . getUplinkBandwidthBits ( ) , UPLINKBANDWIDTHBITS_BINDING ) ; protocolMarshaller . marshall ( networkProfile . getDownlinkBandwidthBits ( ) , DOWNLINKBANDWIDTHBITS_BINDING ) ; protocolMarshaller . marshall ( networkProfile . getUplinkDelayMs ( ) , UPLINKDELAYMS_BINDING ) ; protocolMarshaller . marshall ( networkProfile . getDownlinkDelayMs ( ) , DOWNLINKDELAYMS_BINDING ) ; protocolMarshaller . marshall ( networkProfile . getUplinkJitterMs ( ) , UPLINKJITTERMS_BINDING ) ; protocolMarshaller . marshall ( networkProfile . getDownlinkJitterMs ( ) , DOWNLINKJITTERMS_BINDING ) ; protocolMarshaller . marshall ( networkProfile . getUplinkLossPercent ( ) , UPLINKLOSSPERCENT_BINDING ) ; protocolMarshaller . marshall ( networkProfile . getDownlinkLossPercent ( ) , DOWNLINKLOSSPERCENT_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class cacheobject { /** * Use this API to fetch all the cacheobject resources that are configured on netscaler . */
public static cacheobject [ ] get ( nitro_service service ) throws Exception { } } | cacheobject obj = new cacheobject ( ) ; cacheobject [ ] response = ( cacheobject [ ] ) obj . get_resources ( service ) ; return response ; |
public class BaseImageRecordReader { /** * Called once at initialization .
* @ param conf a configuration for initialization
* @ param split the split that defines the range of records to read
* @ param imageTransform the image transform to use to transform images while loading them
* @ throws java . io . IOException
* @ throws InterruptedException */
public void initialize ( Configuration conf , InputSplit split , ImageTransform imageTransform ) throws IOException , InterruptedException { } } | this . imageLoader = null ; this . imageTransform = imageTransform ; initialize ( conf , split ) ; |
public class GrammaticalStructure { /** * Get a list of GrammaticalRelation between gov and dep . Useful for getting extra dependencies , in which
* two nodes can be linked by multiple arcs . */
public static List < GrammaticalRelation > getListGrammaticalRelation ( TreeGraphNode gov , TreeGraphNode dep ) { } } | List < GrammaticalRelation > list = new ArrayList < GrammaticalRelation > ( ) ; TreeGraphNode govH = gov . highestNodeWithSameHead ( ) ; TreeGraphNode depH = dep . highestNodeWithSameHead ( ) ; /* System . out . println ( " Extra gov node " + gov ) ;
System . out . println ( " govH " + govH ) ;
System . out . println ( " dep node " + dep ) ;
System . out . println ( " depH " + depH ) ; */
Set < Class < ? extends GrammaticalRelationAnnotation > > arcLabels = govH . arcLabelsToNode ( depH ) ; // System . out . println ( " arcLabels : " + arcLabels ) ;
if ( dep != depH ) { Set < Class < ? extends GrammaticalRelationAnnotation > > arcLabels2 = govH . arcLabelsToNode ( dep ) ; // System . out . println ( " arcLabels2 : " + arcLabels2 ) ;
arcLabels . addAll ( arcLabels2 ) ; } // System . out . println ( " arcLabels : " + arcLabels ) ;
for ( Class < ? extends GrammaticalRelationAnnotation > arcLabel : arcLabels ) { if ( arcLabel != null ) { GrammaticalRelation reln2 = GrammaticalRelation . getRelation ( arcLabel ) ; if ( ! list . isEmpty ( ) ) { for ( int i = 0 ; i < list . size ( ) ; i ++ ) { GrammaticalRelation gr = list . get ( i ) ; // if the element in the list is an ancestor of the current relation , replace it
if ( gr . isAncestor ( reln2 ) ) { int index = list . indexOf ( gr ) ; list . set ( index , reln2 ) ; } // if the relation is not an ancestor of an element in the list , we add the relation
else if ( ! reln2 . isAncestor ( gr ) ) { list . add ( reln2 ) ; } } } else { list . add ( reln2 ) ; } } } // System . out . println ( " in list " + list ) ;
return list ; |
public class JawrWicketLinkTagHandler { /** * ( non - Javadoc )
* @ see
* org . apache . wicket . markup . parser . AbstractMarkupFilter # onComponentTag ( org
* . apache . wicket . markup . ComponentTag ) */
@ Override protected MarkupElement onComponentTag ( ComponentTag tag ) throws ParseException { } } | if ( tag == null ) { return tag ; } // Only xml tags not already identified as Wicket components will be
// considered for autolinking . This is because it is assumed that Wicket
// components like images or all other kind of Wicket Links will handle
// it themselves .
// Subclass analyzeAutolinkCondition ( ) to implement you own
// implementation and register the new tag handler with the markup
// parser through Application . newMarkupParser ( ) .
if ( analyzeAutolinkCondition ( tag ) == true ) { // Just a dummy name . The ComponentTag will not be forwarded .
tag . setId ( AUTOLINK_ID ) ; tag . setAutoComponentTag ( true ) ; tag . setModified ( true ) ; return tag ; } return tag ; |
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EClass getIfcOrientedEdge ( ) { } } | if ( ifcOrientedEdgeEClass == null ) { ifcOrientedEdgeEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 401 ) ; } return ifcOrientedEdgeEClass ; |
public class DayOfMonthValueMatcher { /** * 给定的日期是否匹配当前匹配器
* @ param value 被检查的值 , 此处为日
* @ param month 实际的月份
* @ param isLeapYear 是否闰年
* @ return 是否匹配 */
public boolean match ( int value , int month , boolean isLeapYear ) { } } | return ( super . match ( value ) // 在约定日范围内的某一天
// 匹配器中用户定义了最后一天 ( 32表示最后一天 )
|| ( value > 27 && match ( 32 ) && isLastDayOfMonth ( value , month , isLeapYear ) ) ) ; |
public class JDOExpressions { /** * Create a new detached { @ link JDOQuery } instance with the given projection
* @ param expr projection
* @ param < T >
* @ return select ( expr ) */
public static < T > JDOQuery < T > select ( Expression < T > expr ) { } } | return new JDOQuery < Void > ( ) . select ( expr ) ; |
public class AbstractBox { /** * Gets the full size of the box including header and content .
* @ return the box ' s size */
public long getSize ( ) { } } | long size = isParsed ? getContentSize ( ) : content . limit ( ) ; size += ( 8 + // size | type
( size >= ( ( 1L << 32 ) - 8 ) ? 8 : 0 ) + // 32bit - 8 byte size and type
( UserBox . TYPE . equals ( getType ( ) ) ? 16 : 0 ) ) ; size += ( deadBytes == null ? 0 : deadBytes . limit ( ) ) ; return size ; |
public class FaceDetail { /** * Indicates the location of landmarks on the face . Default attribute .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setLandmarks ( java . util . Collection ) } or { @ link # withLandmarks ( java . util . Collection ) } if you want to
* override the existing values .
* @ param landmarks
* Indicates the location of landmarks on the face . Default attribute .
* @ return Returns a reference to this object so that method calls can be chained together . */
public FaceDetail withLandmarks ( Landmark ... landmarks ) { } } | if ( this . landmarks == null ) { setLandmarks ( new java . util . ArrayList < Landmark > ( landmarks . length ) ) ; } for ( Landmark ele : landmarks ) { this . landmarks . add ( ele ) ; } return this ; |
public class LongHashMap { /** * Returns index for Object x . */
private static int hash ( long x , int length ) { } } | int h = ( int ) ( x ^ ( x >>> 32 ) ) ; // This function ensures that hashCodes that differ only by
// constant multiples at each bit position have a bounded
// number of collisions ( approximately 8 at default load factor ) .
h ^= ( h >>> 20 ) ^ ( h >>> 12 ) ; h ^= ( h >>> 7 ) ^ ( h >>> 4 ) ; return ( h ) & ( length - 2 ) ; |
public class AnnotationScannerFactory { /** * Get the annotation scanner
* @ return The scanner */
public static AnnotationScanner getAnnotationScanner ( ) { } } | if ( active != null ) return active ; if ( defaultImplementation == null ) throw new IllegalStateException ( bundle . noAnnotationScanner ( ) ) ; return defaultImplementation ; |
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link AbstractReferenceSystemType } { @ code > }
* @ param value
* Java instance representing xml element ' s value .
* @ return
* the new instance of { @ link JAXBElement } { @ code < } { @ link AbstractReferenceSystemType } { @ code > } */
@ XmlElementDecl ( namespace = "http://www.opengis.net/gml" , name = "_ReferenceSystem" , substitutionHeadNamespace = "http://www.opengis.net/gml" , substitutionHeadName = "Definition" ) public JAXBElement < AbstractReferenceSystemType > create_ReferenceSystem ( AbstractReferenceSystemType value ) { } } | return new JAXBElement < AbstractReferenceSystemType > ( __ReferenceSystem_QNAME , AbstractReferenceSystemType . class , null , value ) ; |
public class SREsPreferencePage { /** * Returns the default SRE or < code > null < / code > if none .
* @ return the default SRE or < code > null < / code > if none */
public ISREInstall getDefaultSRE ( ) { } } | final Object [ ] objects = this . sresList . getCheckedElements ( ) ; if ( objects . length == 0 ) { return null ; } return ( ISREInstall ) objects [ 0 ] ; |
public class IconicsDrawable { /** * Set contour color from color res .
* @ return The current IconicsDrawable for chaining . */
@ NonNull public IconicsDrawable contourColorRes ( @ ColorRes int colorResId ) { } } | return contourColor ( ContextCompat . getColor ( mContext , colorResId ) ) ; |
public class HAConfUtil { /** * Is value of b smaller than value of a .
* @ return True , if b is smaller than a . Always true , if value of a is null . */
static boolean isSmaller ( Long a , Long b ) { } } | return a == null || ( b != null && b < a ) ; |
public class StatementHandle { /** * # ifdef JDK > 6 */
public void setPoolable ( boolean poolable ) throws SQLException { } } | checkClosed ( ) ; try { this . internalStatement . setPoolable ( poolable ) ; } catch ( SQLException e ) { throw this . connectionHandle . markPossiblyBroken ( e ) ; } |
public class ChangeLogActivity { /** * Lifecycle Methods */
@ Override protected void onCreate ( Bundle savedInstanceState ) { } } | super . onCreate ( savedInstanceState ) ; setContentView ( R . layout . activity_changelog ) ; mAppbar = ButterKnife . findById ( this , R . id . appbar ) ; mContainer = ButterKnife . findById ( this , R . id . container ) ; configAppBar ( ) ; parseExtras ( savedInstanceState ) ; |
public class AbcGrammar { /** * paren - voice : : = " ( " single - voice 1 * ( 1 * WSP single - voice ) " ) "
* on same staff */
Rule ParenVoice ( ) { } } | return Sequence ( '(' , SingleVoice ( ) , OneOrMore ( Sequence ( OneOrMore ( WSP ( ) ) , SingleVoice ( ) ) ) ) . label ( ParenVoice ) ; |
public class Team { /** * Update a group of oTask / Activity records
* @ param company Company ID
* @ param params Parameters
* @ throwsJSONException If error occurred
* @ return { @ link JSONObject } */
public JSONObject updateBatch ( String company , HashMap < String , String > params ) throws JSONException { } } | return oClient . put ( "/otask/v1/tasks/companies/" + company + "/tasks/batch" , params ) ; |
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EClass getIfcRelConnects ( ) { } } | if ( ifcRelConnectsEClass == null ) { ifcRelConnectsEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 533 ) ; } return ifcRelConnectsEClass ; |
public class RNCryptorNative { /** * Decrypts encrypted base64 string and returns via callback
* @ param encrypted base64 string
* @ param password strong generated password
* @ param RNCryptorNativeCallback just a callback */
public static void decryptAsync ( String encrypted , String password , RNCryptorNativeCallback RNCryptorNativeCallback ) { } } | String decrypted ; try { decrypted = new RNCryptorNative ( ) . decrypt ( encrypted , password ) ; RNCryptorNativeCallback . done ( decrypted , null ) ; } catch ( Exception e ) { RNCryptorNativeCallback . done ( null , e ) ; } |
public class SVG { /** * Change the width of the document by altering the " width " attribute
* of the root { @ code < svg > } element .
* @ param value A valid SVG ' length ' attribute , such as " 100px " or " 10cm " .
* @ throws SVGParseException if { @ code value } cannot be parsed successfully .
* @ throws IllegalArgumentException if there is no current SVG document loaded . */
@ SuppressWarnings ( { } } | "WeakerAccess" , "unused" } ) public void setDocumentWidth ( String value ) throws SVGParseException { if ( this . rootElement == null ) throw new IllegalArgumentException ( "SVG document is empty" ) ; this . rootElement . width = SVGParser . parseLength ( value ) ; |
public class ZealotKhala { /** * 生成带 " OR " 前缀大于等于查询的SQL片段 .
* @ param field 数据库字段
* @ param value 值
* @ return ZealotKhala实例 */
public ZealotKhala orMoreEqual ( String field , Object value ) { } } | return this . doNormal ( ZealotConst . OR_PREFIX , field , value , ZealotConst . GTE_SUFFIX , true ) ; |
public class LargestChainDescriptor { /** * Gets the parameters attribute of the LargestChainDescriptor object .
* @ return The parameters value
* @ see # setParameters */
@ Override public Object [ ] getParameters ( ) { } } | // return the parameters as used for the descriptor calculation
Object [ ] params = new Object [ 2 ] ; params [ 0 ] = checkAromaticity ; params [ 1 ] = checkRingSystem ; return params ; |
public class TypeVariableName { /** * Returns type variable equivalent to { @ code element } . */
public static TypeVariableName get ( TypeParameterElement element ) { } } | String name = element . getSimpleName ( ) . toString ( ) ; List < ? extends TypeMirror > boundsMirrors = element . getBounds ( ) ; List < TypeName > boundsTypeNames = new ArrayList < > ( ) ; for ( TypeMirror typeMirror : boundsMirrors ) { boundsTypeNames . add ( TypeName . get ( typeMirror ) ) ; } return TypeVariableName . of ( name , boundsTypeNames ) ; |
public class ZooKeeperMasterModel { /** * Undeploys the job specified by { @ code jobId } on { @ code host } . */
@ Override public Deployment undeployJob ( final String host , final JobId jobId , final String token ) throws HostNotFoundException , JobNotDeployedException , TokenVerificationException { } } | log . info ( "undeploying {}: {}" , jobId , host ) ; final ZooKeeperClient client = provider . get ( "undeployJob" ) ; assertHostExists ( client , host ) ; final Deployment deployment = getDeployment ( host , jobId ) ; if ( deployment == null ) { throw new JobNotDeployedException ( host , jobId ) ; } final Job job = getJob ( client , jobId ) ; verifyToken ( token , job ) ; final String configHostJobPath = Paths . configHostJob ( host , jobId ) ; try { // use listRecursive to remove both job node and its child creation node
final List < String > nodes = newArrayList ( reverse ( client . listRecursive ( configHostJobPath ) ) ) ; nodes . add ( Paths . configJobHost ( jobId , host ) ) ; final List < Integer > staticPorts = staticPorts ( job ) ; for ( final int port : staticPorts ) { nodes . add ( Paths . configHostPort ( host , port ) ) ; } client . transaction ( delete ( nodes ) ) ; } catch ( NoNodeException e ) { // This method is racy since it ' s possible someone undeployed the job after we called
// getDeployment and checked the job exists . If we now discover the job is undeployed ,
// throw an exception and handle it the same as if we discovered this earlier .
throw new JobNotDeployedException ( host , jobId ) ; } catch ( KeeperException e ) { throw new HeliosRuntimeException ( "Removing deployment failed" , e ) ; } return deployment ; |
public class RubyOutputHandler { /** * rb _ syck _ output _ handler */
public void handle ( Emitter emitter , byte [ ] str , int len ) { } } | YEmitter . Extra bonus = ( YEmitter . Extra ) emitter . bonus ; IRubyObject dest = bonus . port ; if ( dest instanceof RubyString ) { ( ( RubyString ) dest ) . cat ( new ByteList ( str , 0 , len , false ) ) ; } else { dest . callMethod ( runtime . getCurrentContext ( ) , "write" , RubyString . newStringShared ( runtime , str , 0 , len ) ) ; } |
public class JSONValue { /** * remap field from java to json .
* @ since 2.1.1 */
public static < T > void remapField ( Class < T > type , String jsonFieldName , String javaFieldName ) { } } | defaultReader . remapField ( type , jsonFieldName , javaFieldName ) ; defaultWriter . remapField ( type , javaFieldName , jsonFieldName ) ; |
public class ApiOvhHostingreseller { /** * Change language of the Plesk instance
* REST : POST / hosting / reseller / { serviceName } / language
* @ param serviceName [ required ] The internal name of your reseller service
* @ param language [ required ] Locale value */
public String serviceName_language_POST ( String serviceName , OvhPleskLanguageTypeEnum language ) throws IOException { } } | String qPath = "/hosting/reseller/{serviceName}/language" ; StringBuilder sb = path ( qPath , serviceName ) ; HashMap < String , Object > o = new HashMap < String , Object > ( ) ; addBody ( o , "language" , language ) ; String resp = exec ( qPath , "POST" , sb . toString ( ) , o ) ; return convertTo ( resp , String . class ) ; |
public class PotentialDeclaration { /** * Remove this " potential declaration " completely .
* Usually , this is because the same symbol has already been declared in this file . */
final void remove ( AbstractCompiler compiler ) { } } | if ( isDetached ( ) ) { return ; } Node statement = getRemovableNode ( ) ; NodeUtil . deleteNode ( statement , compiler ) ; statement . removeChildren ( ) ; |
public class HttpRequestFactory { /** * Builds a { @ code DELETE } request for the given URL .
* @ param url HTTP request URL or { @ code null } for none
* @ return new HTTP request */
public HttpRequest buildDeleteRequest ( GenericUrl url ) throws IOException { } } | return buildRequest ( HttpMethods . DELETE , url , null ) ; |
public class CommerceCountryUtil { /** * Returns a range of all the commerce countries where groupId = & # 63 ; and shippingAllowed = & # 63 ; and active = & # 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 CommerceCountryModelImpl } . 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 groupId the group ID
* @ param shippingAllowed the shipping allowed
* @ param active the active
* @ param start the lower bound of the range of commerce countries
* @ param end the upper bound of the range of commerce countries ( not inclusive )
* @ return the range of matching commerce countries */
public static List < CommerceCountry > findByG_S_A ( long groupId , boolean shippingAllowed , boolean active , int start , int end ) { } } | return getPersistence ( ) . findByG_S_A ( groupId , shippingAllowed , active , start , end ) ; |
public class SID { /** * Adds sub - authority : a principal relative to the IdentifierAuthority .
* @ param sub sub - authority .
* @ return the current SID instance . */
public SID addSubAuthority ( byte [ ] sub ) { } } | if ( sub == null || sub . length != 4 ) { throw new IllegalArgumentException ( "Invalid sub-authority to be added" ) ; } this . subAuthorities . add ( Arrays . copyOf ( sub , sub . length ) ) ; return this ; |
public class AgentUtils { /** * Collect the main log files into a map .
* @ param karafData the Karaf ' s data directory
* @ return a non - null map */
public static Map < String , byte [ ] > collectLogs ( String karafData ) throws IOException { } } | Map < String , byte [ ] > logFiles = new HashMap < > ( 2 ) ; if ( ! Utils . isEmptyOrWhitespaces ( karafData ) ) { String [ ] names = { "karaf.log" , "roboconf.log" } ; for ( String name : names ) { File log = new File ( karafData , AgentConstants . KARAF_LOGS_DIRECTORY + "/" + name ) ; if ( ! log . exists ( ) ) continue ; String content = Utils . readFileContent ( log ) ; logFiles . put ( name , content . getBytes ( StandardCharsets . UTF_8 ) ) ; } } return logFiles ; |
public class WebDriverHelper { /** * Gets a profile with a specific user agent with or without javascript
* enabled .
* @ param userAgent
* the user agent
* @ param javascriptEnabled
* javascript enabled or not
* @ return a FirefoxDriver instance with javascript and user agent seetigs
* configured */
public static WebDriver getFirefoxDriverWithJSSettings ( final String userAgent , final boolean javascriptEnabled ) { } } | FirefoxProfile profile = new FirefoxProfile ( ) ; profile . setPreference ( "general.useragent.override" , userAgent ) ; profile . setPreference ( "javascript.enabled" , javascriptEnabled ) ; WebDriver driver = new FirefoxDriver ( profile ) ; return driver ; |
public class AWSGlueClient { /** * Deletes a specified trigger . If the trigger is not found , no exception is thrown .
* @ param deleteTriggerRequest
* @ return Result of the DeleteTrigger operation returned by the service .
* @ throws InvalidInputException
* The input provided was not valid .
* @ throws InternalServiceException
* An internal service error occurred .
* @ throws OperationTimeoutException
* The operation timed out .
* @ throws ConcurrentModificationException
* Two processes are trying to modify a resource simultaneously .
* @ sample AWSGlue . DeleteTrigger
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / glue - 2017-03-31 / DeleteTrigger " target = " _ top " > AWS API
* Documentation < / a > */
@ Override public DeleteTriggerResult deleteTrigger ( DeleteTriggerRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeDeleteTrigger ( request ) ; |
public class PiwikRequest { /** * Set a stored parameter and verify it is a non - empty string .
* @ param key the parameter ' s key
* @ param value the parameter ' s value . Cannot be the empty . Removes the parameter if null
* string */
private void setNonEmptyStringParameter ( String key , String value ) { } } | if ( value == null ) { parameters . remove ( key ) ; } else if ( value . length ( ) == 0 ) { throw new IllegalArgumentException ( "Value cannot be empty." ) ; } else { parameters . put ( key , value ) ; } |
public class DefaultGroovyMethods { /** * Finds all permutations of an iterable .
* Example usage :
* < pre class = " groovyTestCase " > def result = [ 1 , 2 , 3 ] . permutations ( )
* assert result = = [ [ 3 , 2 , 1 ] , [ 3 , 1 , 2 ] , [ 1 , 3 , 2 ] , [ 2 , 3 , 1 ] , [ 2 , 1 , 3 ] , [ 1 , 2 , 3 ] ] as Set < / pre >
* @ param self the Iterable of items
* @ return the permutations from the list
* @ since 1.7.0 */
public static < T > Set < List < T > > permutations ( Iterable < T > self ) { } } | Set < List < T > > ans = new HashSet < List < T > > ( ) ; PermutationGenerator < T > generator = new PermutationGenerator < T > ( self ) ; while ( generator . hasNext ( ) ) { ans . add ( generator . next ( ) ) ; } return ans ; |
public class Toothpick { /** * Opens a scope without any parent .
* If a scope by this { @ code name } already exists , it is returned .
* Otherwise a new scope is created .
* @ param name the name of the scope to open .
* @ param shouldCheckMultipleRootScopes whether or not to check that the return scope
* is not introducing a second tree in TP forest of scopes . */
private static Scope openScope ( Object name , boolean shouldCheckMultipleRootScopes ) { } } | if ( name == null ) { throw new IllegalArgumentException ( "null scope names are not allowed." ) ; } Scope scope = MAP_KEY_TO_SCOPE . get ( name ) ; if ( scope != null ) { return scope ; } scope = new ScopeImpl ( name ) ; Scope previous = MAP_KEY_TO_SCOPE . putIfAbsent ( name , scope ) ; if ( previous != null ) { // if there was already a scope by this name , we return it
scope = previous ; } else if ( shouldCheckMultipleRootScopes ) { ConfigurationHolder . configuration . checkMultipleRootScopes ( scope ) ; } return scope ; |
public class PCMProcessors { /** * Process the StreamInfo block .
* @ param info the StreamInfo block
* @ see de . quippy . jflac . PCMProcessor # processStreamInfo ( de . quippy . jflac . metadata . StreamInfo ) */
public void processStreamInfo ( StreamInfo info ) { } } | synchronized ( pcmProcessors ) { Iterator < PCMProcessor > it = pcmProcessors . iterator ( ) ; while ( it . hasNext ( ) ) { PCMProcessor processor = ( PCMProcessor ) it . next ( ) ; processor . processStreamInfo ( info ) ; } } |
public class Communication { /** * Information about the attachments to the case communication .
* @ return Information about the attachments to the case communication . */
public java . util . List < AttachmentDetails > getAttachmentSet ( ) { } } | if ( attachmentSet == null ) { attachmentSet = new com . amazonaws . internal . SdkInternalList < AttachmentDetails > ( ) ; } return attachmentSet ; |
public class TcpClient { /** * Setup all lifecycle callbacks called on or after { @ link io . netty . channel . Channel }
* has been connected and after it has been disconnected .
* @ param doOnConnect a consumer observing client start event
* @ param doOnConnected a consumer observing client started event
* @ param doOnDisconnected a consumer observing client stop event
* @ return a new { @ link TcpClient } */
public final TcpClient doOnLifecycle ( Consumer < ? super Bootstrap > doOnConnect , Consumer < ? super Connection > doOnConnected , Consumer < ? super Connection > doOnDisconnected ) { } } | Objects . requireNonNull ( doOnConnect , "doOnConnect" ) ; Objects . requireNonNull ( doOnConnected , "doOnConnected" ) ; Objects . requireNonNull ( doOnDisconnected , "doOnDisconnected" ) ; return new TcpClientDoOn ( this , doOnConnect , doOnConnected , doOnDisconnected ) ; |
public class JFapByteBuffer { /** * This method will create a new WsByteBuffer . By default it will be created to hold 200 bytes
* but if the size needed is larger than this then the buffer will simply be allocated to hold
* the exact number of bytes requested .
* @ param sizeNeeded The amount of data waiting to be put into a buffer .
* @ return Returns a new WsByteBuffer */
private WsByteBuffer createNewWsByteBuffer ( int sizeNeeded ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "createNewWsByteBuffer" , Integer . valueOf ( sizeNeeded ) ) ; if ( sizeNeeded < DEFAULT_BUFFER_SIZE ) { sizeNeeded = DEFAULT_BUFFER_SIZE ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Allocating a buffer of size: " + sizeNeeded ) ; WsByteBuffer buffer = poolMan . allocate ( sizeNeeded ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "createNewWsByteBuffer" , buffer ) ; return buffer ; |
public class UtilIO { /** * Opens up a dialog box asking the user to select a file . If the user cancels
* it either returns null or quits the program .
* @ param exitOnCancel If it should quit on cancel or not .
* @ return Name of the selected file or null if nothing was selected . */
public static String selectFile ( boolean exitOnCancel ) { } } | String fileName = null ; JFileChooser fc = new JFileChooser ( ) ; int returnVal = fc . showOpenDialog ( null ) ; if ( returnVal == JFileChooser . APPROVE_OPTION ) { fileName = fc . getSelectedFile ( ) . getAbsolutePath ( ) ; } else if ( exitOnCancel ) { System . exit ( 0 ) ; } return fileName ; |
public class ClusteredCacheConfigurationAdd { /** * Create a Configuration object initialized from the data in the operation .
* @ param cache data representing cache configuration
* @ param builder
* @ param dependencies
* @ return initialised Configuration object */
@ Override void processModelNode ( OperationContext context , String containerName , ModelNode cache , ConfigurationBuilder builder , List < Dependency < ? > > dependencies ) throws OperationFailedException { } } | // process cache attributes and elements
super . processModelNode ( context , containerName , cache , builder , dependencies ) ; // adjust the cache mode used based on the value of clustered attribute MODE
ModelNode modeModel = ClusteredCacheConfigurationResource . MODE . resolveModelAttribute ( context , cache ) ; CacheMode cacheMode = modeModel . isDefined ( ) ? Mode . valueOf ( modeModel . asString ( ) ) . apply ( this . mode ) : this . mode ; builder . clustering ( ) . cacheMode ( cacheMode ) ; final long remoteTimeout = ClusteredCacheConfigurationResource . REMOTE_TIMEOUT . resolveModelAttribute ( context , cache ) . asLong ( ) ; // process clustered cache attributes and elements
if ( cacheMode . isSynchronous ( ) ) { builder . clustering ( ) . remoteTimeout ( remoteTimeout ) ; } |
public class StringUtil { /** * Removes all other characters from a string except digits . A good way
* of cleaing up something like a phone number .
* @ param str0 The string to clean up
* @ return A new String that has all characters except digits removed */
static public String removeAllCharsExceptDigits ( String str0 ) { } } | if ( str0 == null ) { return null ; } if ( str0 . length ( ) == 0 ) { return str0 ; } StringBuilder buf = new StringBuilder ( str0 . length ( ) ) ; int length = str0 . length ( ) ; for ( int i = 0 ; i < length ; i ++ ) { char c = str0 . charAt ( i ) ; if ( Character . isDigit ( c ) ) { // append this character to our string
buf . append ( c ) ; } } return buf . toString ( ) ; |
public class FlashImpl { /** * Creates a Cookie with the given name and value .
* In addition , it will be configured with maxAge = - 1 , the current request path and secure value .
* @ param name
* @ param value
* @ param externalContext
* @ return */
private Cookie _createFlashCookie ( String name , String value , ExternalContext externalContext ) { } } | Cookie cookie = new Cookie ( name , value ) ; cookie . setMaxAge ( - 1 ) ; cookie . setPath ( _getCookiePath ( externalContext ) ) ; cookie . setSecure ( externalContext . isSecure ( ) ) ; // cookie . setHttpOnly ( true ) ;
if ( ServletSpecifications . isServlet30Available ( ) ) { _Servlet30Utils . setCookieHttpOnly ( cookie , true ) ; } return cookie ; |
public class ManagerConfiguration { /** * XML Utils */
private Map < String , String > processStartElement ( XMLStreamReader reader , String elementName , String ... requiredAttributes ) throws XMLStreamException { } } | Map < String , String > attrs = processStartElementPrivate ( reader , elementName , requiredAttributes ) ; reader . nextTag ( ) ; return attrs ; |
public class Factory { /** * Create a { @ link Featurable } from its { @ link Media } using a generic way . The concerned class to instantiate and
* its constructor must be public , and can have the following parameter : ( { @ link Setup } ) .
* Automatically add { @ link IdentifiableModel } if feature does not have { @ link Identifiable } feature .
* Destroyed { @ link Featurable } can be cached to avoid { @ link Featurable } creation if has { @ link Recycler } and
* { @ link Recyclable } { @ link Feature } s . If cache associated to media is available , it is
* { @ link Recyclable # recycle ( ) } and then returned .
* @ param < O > The featurable type .
* @ param media The featurable media .
* @ return The featurable instance .
* @ throws LionEngineException If { @ link Media } is < code > null < / code > or { @ link Setup } not found . */
@ SuppressWarnings ( "unchecked" ) public < O extends Featurable > O create ( Media media ) { } } | if ( cache . containsKey ( media ) && ! cache . get ( media ) . isEmpty ( ) ) { final Featurable featurable = cache . get ( media ) . poll ( ) ; featurable . getFeature ( Recycler . class ) . recycle ( ) ; return ( O ) featurable ; } final Setup setup = getSetup ( media ) ; final Class < O > type = setup . getConfigClass ( classLoader ) ; try { return createFeaturable ( type , setup ) ; } catch ( final NoSuchMethodException exception ) { throw new LionEngineException ( exception , ERROR_CONSTRUCTOR_MISSING + media ) ; } |
public class KriptonContentValues { /** * Adds a value to the set .
* @ param value the data for the value to put */
public void put ( Long value ) { } } | if ( value == null ) { this . compiledStatement . bindNull ( compiledStatementBindIndex ++ ) ; } else { compiledStatement . bindLong ( compiledStatementBindIndex ++ , ( long ) value ) ; } |
public class ListResourceInventoryRequest { /** * One or more filters .
* @ param filters
* One or more filters . */
public void setFilters ( java . util . Collection < InventoryFilter > filters ) { } } | if ( filters == null ) { this . filters = null ; return ; } this . filters = new java . util . ArrayList < InventoryFilter > ( filters ) ; |
public class ThymeleafHtmlRenderer { /** * Thymeleaf ' s reserved words are already checked in Thymeleaf process so no check them here */
protected void checkRegisteredDataUsingReservedWord ( ActionRuntime runtime , WebContext context , String varKey ) { } } | if ( isSuppressRegisteredDataUsingReservedWordCheck ( ) ) { return ; } if ( context . getVariableNames ( ) . contains ( varKey ) ) { throwThymeleafRegisteredDataUsingReservedWordException ( runtime , context , varKey ) ; } |
public class Math { /** * Unitize an array so that L1 norm of x is 1.
* @ param x an array of nonnegative double */
public static void unitize1 ( double [ ] x ) { } } | double n = norm1 ( x ) ; for ( int i = 0 ; i < x . length ; i ++ ) { x [ i ] /= n ; } |
public class CmsSetupBean { /** * Prepares step 8 of the setup wizard . < p >
* @ return true if the workplace should be imported */
public boolean prepareStep8 ( ) { } } | if ( isInitialized ( ) ) { try { checkEthernetAddress ( ) ; // backup the XML configuration
backupConfiguration ( CmsImportExportConfiguration . DEFAULT_XML_FILE_NAME , CmsImportExportConfiguration . DEFAULT_XML_FILE_NAME + CmsConfigurationManager . POSTFIX_ORI ) ; backupConfiguration ( CmsModuleConfiguration . DEFAULT_XML_FILE_NAME , CmsModuleConfiguration . DEFAULT_XML_FILE_NAME + CmsConfigurationManager . POSTFIX_ORI ) ; backupConfiguration ( CmsSearchConfiguration . DEFAULT_XML_FILE_NAME , CmsSearchConfiguration . DEFAULT_XML_FILE_NAME + CmsConfigurationManager . POSTFIX_ORI ) ; backupConfiguration ( CmsSystemConfiguration . DEFAULT_XML_FILE_NAME , CmsSystemConfiguration . DEFAULT_XML_FILE_NAME + CmsConfigurationManager . POSTFIX_ORI ) ; backupConfiguration ( CmsVfsConfiguration . DEFAULT_XML_FILE_NAME , CmsVfsConfiguration . DEFAULT_XML_FILE_NAME + CmsConfigurationManager . POSTFIX_ORI ) ; backupConfiguration ( CmsWorkplaceConfiguration . DEFAULT_XML_FILE_NAME , CmsWorkplaceConfiguration . DEFAULT_XML_FILE_NAME + CmsConfigurationManager . POSTFIX_ORI ) ; backupConfiguration ( CmsConfigurationManager . DEFAULT_XML_FILE_NAME , CmsConfigurationManager . DEFAULT_XML_FILE_NAME + CmsConfigurationManager . POSTFIX_ORI ) ; // save Properties to file " opencms . properties "
setDatabase ( m_databaseKey ) ; saveProperties ( getProperties ( ) , CmsSystemInfo . FILE_PROPERTIES , true ) ; // if has sql driver the sql scripts will be eventualy executed
CmsSetupTestResult testResult = new CmsSetupTestSimapi ( ) . execute ( this ) ; if ( testResult . getResult ( ) . equals ( I_CmsSetupTest . RESULT_FAILED ) ) { // " / opencms / vfs / resources / resourceloaders / loader [ @ class = ' org . opencms . loader . CmsImageLoader ' ] / param [ @ name = ' image . scaling . enabled ' ] " ;
StringBuffer xp = new StringBuffer ( 256 ) ; xp . append ( "/" ) . append ( CmsConfigurationManager . N_ROOT ) ; xp . append ( "/" ) . append ( CmsVfsConfiguration . N_VFS ) ; xp . append ( "/" ) . append ( CmsVfsConfiguration . N_RESOURCES ) ; xp . append ( "/" ) . append ( CmsVfsConfiguration . N_RESOURCELOADERS ) ; xp . append ( "/" ) . append ( CmsVfsConfiguration . N_LOADER ) ; xp . append ( "[@" ) . append ( I_CmsXmlConfiguration . A_CLASS ) ; xp . append ( "='" ) . append ( CmsImageLoader . class . getName ( ) ) ; xp . append ( "']/" ) . append ( I_CmsXmlConfiguration . N_PARAM ) ; xp . append ( "[@" ) . append ( I_CmsXmlConfiguration . A_NAME ) ; xp . append ( "='" ) . append ( CmsImageLoader . CONFIGURATION_SCALING_ENABLED ) . append ( "']" ) ; getXmlHelper ( ) . setValue ( CmsVfsConfiguration . DEFAULT_XML_FILE_NAME , xp . toString ( ) , Boolean . FALSE . toString ( ) ) ; } // / opencms / system / sites / workplace - server
StringBuffer xp = new StringBuffer ( 256 ) ; xp . append ( "/" ) . append ( CmsConfigurationManager . N_ROOT ) ; xp . append ( "/" ) . append ( CmsSitesConfiguration . N_SITES ) ; xp . append ( "/" ) . append ( CmsSitesConfiguration . N_WORKPLACE_SERVER ) ; getXmlHelper ( ) . setValue ( CmsSitesConfiguration . DEFAULT_XML_FILE_NAME , xp . toString ( ) , getWorkplaceSite ( ) ) ; // / opencms / system / sites / site [ @ uri = ' / sites / default / ' ] / @ server
xp = new StringBuffer ( 256 ) ; xp . append ( "/" ) . append ( CmsConfigurationManager . N_ROOT ) ; xp . append ( "/" ) . append ( CmsSitesConfiguration . N_SITES ) ; xp . append ( "/" ) . append ( I_CmsXmlConfiguration . N_SITE ) ; xp . append ( "[@" ) . append ( I_CmsXmlConfiguration . A_URI ) ; xp . append ( "='" ) . append ( CmsResource . VFS_FOLDER_SITES ) ; xp . append ( "/default/']/@" ) . append ( CmsSitesConfiguration . A_SERVER ) ; getXmlHelper ( ) . setValue ( CmsSitesConfiguration . DEFAULT_XML_FILE_NAME , xp . toString ( ) , getWorkplaceSite ( ) ) ; getXmlHelper ( ) . writeAll ( ) ; } catch ( Exception e ) { if ( LOG . isErrorEnabled ( ) ) { LOG . error ( e . getLocalizedMessage ( ) , e ) ; } } } return true ; |
public class XPath { /** * Set the raw expression object for this object .
* @ param exp the raw Expression object , which should not normally be null . */
public void setExpression ( Expression exp ) { } } | if ( null != m_mainExp ) exp . exprSetParent ( m_mainExp . exprGetParent ( ) ) ; // a bit bogus
m_mainExp = exp ; |
public class Context { /** * Notify any registered listeners that a bounded property has changed
* @ see # addPropertyChangeListener ( java . beans . PropertyChangeListener )
* @ see # removePropertyChangeListener ( java . beans . PropertyChangeListener )
* @ see java . beans . PropertyChangeListener
* @ see java . beans . PropertyChangeEvent
* @ param property the bound property
* @ param oldValue the old value
* @ param newValue the new value */
final void firePropertyChange ( String property , Object oldValue , Object newValue ) { } } | Object listeners = propertyListeners ; if ( listeners != null ) { firePropertyChangeImpl ( listeners , property , oldValue , newValue ) ; } |
public class BitfinexCurrencyPair { /** * Retrieves bitfinex currency pair
* @ param currency currency ( from )
* @ param profitCurrency currency ( to )
* @ return BitfinexCurrencyPair */
public static BitfinexCurrencyPair of ( final String currency , final String profitCurrency ) { } } | final String key = buildCacheKey ( currency , profitCurrency ) ; final BitfinexCurrencyPair bcp = instances . get ( key ) ; if ( bcp == null ) { throw new IllegalArgumentException ( "CurrencyPair is not registered: " + currency + " " + profitCurrency ) ; } return bcp ; |
public class StringGroovyMethods { /** * Process each regex group matched substring of the given CharSequence . If the closure
* parameter takes one argument , an array with all match groups is passed to it .
* If the closure takes as many arguments as there are match groups , then each
* parameter will be one match group .
* @ param self the source CharSequence
* @ param regex a Regex CharSequence
* @ param closure a closure with one parameter or as much parameters as groups
* @ return the source CharSequence
* @ see # eachMatch ( String , String , groovy . lang . Closure )
* @ since 1.8.2 */
public static < T extends CharSequence > T eachMatch ( T self , CharSequence regex , @ ClosureParams ( value = FromString . class , options = { } } | "List<String>" , "String[]" } ) Closure closure ) { eachMatch ( self . toString ( ) , regex . toString ( ) , closure ) ; return self ; |
public class DeploymentUtil { /** * d366807.3 */
private static Method [ ] sortMethods ( ArrayList < Method > methods ) { } } | int numMethods = methods . size ( ) ; Method result [ ] = new Method [ numMethods ] ; // Insert each element of given list of methods into result
// array in sorted order .
for ( int i = 0 ; i < numMethods ; i ++ ) { Method currMethod = methods . get ( i ) ; String currMethodName = currMethod . toString ( ) ; int insertIndex = 0 ; while ( insertIndex < i ) { if ( currMethodName . compareTo ( result [ insertIndex ] . toString ( ) ) <= 0 ) { break ; } insertIndex ++ ; } for ( int j = insertIndex ; j <= i ; j ++ ) { Method tmpMethod = result [ j ] ; result [ j ] = currMethod ; currMethod = tmpMethod ; } } return result ; |
public class ASTUtil { /** * Returns the < CODE > TypeDeclaration < / CODE > for the specified
* < CODE > ClassAnnotation < / CODE > . The type has to be declared in the
* specified < CODE > CompilationUnit < / CODE > .
* @ param compilationUnit
* The < CODE > CompilationUnit < / CODE > , where the
* < CODE > TypeDeclaration < / CODE > is declared in .
* @ param classAnno
* The < CODE > ClassAnnotation < / CODE > , which contains the class
* name of the < CODE > TypeDeclaration < / CODE > .
* @ return the < CODE > TypeDeclaration < / CODE > found in the specified
* < CODE > CompilationUnit < / CODE > .
* @ throws TypeDeclarationNotFoundException
* if no matching < CODE > TypeDeclaration < / CODE > was found . */
public static TypeDeclaration getTypeDeclaration ( CompilationUnit compilationUnit , ClassAnnotation classAnno ) throws TypeDeclarationNotFoundException { } } | requireNonNull ( classAnno , "class annotation" ) ; return getTypeDeclaration ( compilationUnit , classAnno . getClassName ( ) ) ; |
public class ExpectedConditions { /** * An expectation for checking that an element is present on the DOM of a page and visible .
* Visibility means that the element is not only displayed but also has a height and width that is
* greater than 0.
* @ param locator used to find the element
* @ return the WebElement once it is located and visible */
public static ExpectedCondition < WebElement > visibilityOfElementLocated ( final By locator ) { } } | return new ExpectedCondition < WebElement > ( ) { @ Override public WebElement apply ( WebDriver driver ) { try { return elementIfVisible ( driver . findElement ( locator ) ) ; } catch ( StaleElementReferenceException e ) { return null ; } } @ Override public String toString ( ) { return "visibility of element located by " + locator ; } } ; |
public class GenericEditableTableCell { /** * Any action attempting to commit an edit should call this method rather than commit the edit directly itself . This
* method will perform any validation and conversion required on the value . For text values that normally means this
* method just commits the edit but for numeric values , for example , it may first parse the given input . < p > The
* only situation that needs to be treated specially is when the field is losing focus . If you user hits enter to
* commit the cell with bad data we can happily cancel the commit and force them to enter a real value . If they
* click away from the cell though we want to give them their old value back .
* @ param losingFocus true if the reason for the call was because the field is losing focus . */
protected void commitHelper ( boolean losingFocus ) { } } | if ( editorNode == null ) { return ; } try { builder . validateValue ( ) ; commitEdit ( ( T ) builder . getValue ( ) ) ; builder . nullEditorNode ( ) ; editorNode = null ; } catch ( Exception ex ) { if ( commitExceptionConsumer != null ) { commitExceptionConsumer . accept ( ex ) ; } if ( losingFocus ) { cancelEdit ( ) ; } } |
public class LRUProtectionStorage { /** * The touch method can be used to renew an element and move it to the from of the LRU queue .
* @ param key The key of the element to renew
* @ param value A value to newly associate with the key */
public synchronized void touch ( final Object key , final Object value ) { } } | remove ( key ) ; put ( key , value ) ; |
public class HashMap { /** * Returns a power of two size for the given target capacity . */
static final int tableSizeFor ( int cap ) { } } | int n = cap - 1 ; n |= n >>> 1 ; n |= n >>> 2 ; n |= n >>> 4 ; n |= n >>> 8 ; n |= n >>> 16 ; return ( n < 0 ) ? 1 : ( n >= MAXIMUM_CAPACITY ) ? MAXIMUM_CAPACITY : n + 1 ; |
public class ServiceLoaderUtil { /** * Finds the first implementation of the given service type and creates its instance .
* @ param clazz service type
* @ return the first implementation of the given service type */
public static < T > Optional < T > findFirst ( Class < T > clazz ) { } } | ServiceLoader < T > load = ServiceLoader . load ( clazz ) ; return StreamSupport . stream ( load . spliterator ( ) , false ) . findFirst ( ) ; |
public class ThreadPool { /** * Checks all active threads in this thread pool to determine if
* they are hung . The definition of hung is provided by the
* MonitorPlugin .
* @ see MonitorPlugin */
public void checkAllThreads ( ) { } } | // if nothing is plugged in , exit early
if ( this . monitorPlugin == null ) { return ; } long currentTime = 0 ; // lazily initialize current time
try { for ( Iterator i = this . threads_ . values ( ) . iterator ( ) ; i . hasNext ( ) ; ) { Worker thread = ( Worker ) i . next ( ) ; synchronized ( thread ) { // d204471
if ( thread . getStartTime ( ) > 0 ) { if ( currentTime == 0 ) { currentTime = System . currentTimeMillis ( ) ; } if ( ! thread . isHung && this . monitorPlugin . checkThread ( thread , thread . threadNumber , currentTime - thread . getStartTime ( ) ) ) { // PK25446
thread . isHung = true ; } } } } this . lastThreadCheckDidntComplete = false ; // D222794
} catch ( ConcurrentModificationException e ) { // begin D222794
// NOTE : we can pretty much ignore this exception . . . if
// we occasionally fail on the check , we ' ll be OK . So
// we simply keep track with a flag . If two consecutive
// checks fail , then we ' ll log to FFDC
if ( this . lastThreadCheckDidntComplete ) { // Alex Ffdc . log ( e , this , this . getClass ( ) . getName ( ) , " 1181 " , this ) ; / /
// D477704.2
} this . lastThreadCheckDidntComplete = true ; } // end D222794 |
public class ListVersionsResponse { /** * < pre >
* The versions belonging to the requested service .
* < / pre >
* < code > repeated . google . appengine . v1 . Version versions = 1 ; < / code > */
public com . google . appengine . v1 . Version getVersions ( int index ) { } } | return versions_ . get ( index ) ; |
public class Group { /** * Adds user agent .
* @ param userAgent host name */
public void addUserAgent ( String userAgent ) { } } | if ( userAgent . equals ( "*" ) ) { anyAgent = true ; } else { this . userAgents . add ( userAgent ) ; } |
public class ColtUtils { /** * Returns v = beta * A . b .
* Useful in avoiding the need of the copy ( ) in the colt api . */
public static final DoubleMatrix1D zMult ( final DoubleMatrix2D A , final DoubleMatrix1D b , final double beta ) { } } | if ( A . columns ( ) != b . size ( ) ) { throw new IllegalArgumentException ( "wrong matrices dimensions" ) ; } final DoubleMatrix1D ret = DoubleFactory1D . dense . make ( A . rows ( ) ) ; if ( A instanceof SparseDoubleMatrix2D ) { // sparse matrix
A . forEachNonZero ( new IntIntDoubleFunction ( ) { @ Override public double apply ( int i , int j , double Aij ) { double vi = 0 ; vi += Aij * b . getQuick ( j ) ; ret . setQuick ( i , ret . getQuick ( i ) + beta * vi ) ; return Aij ; } } ) ; } else { // dense matrix
for ( int i = 0 ; i < A . rows ( ) ; i ++ ) { double vi = 0 ; for ( int j = 0 ; j < A . columns ( ) ; j ++ ) { vi += A . getQuick ( i , j ) * b . getQuick ( j ) ; } ret . setQuick ( i , beta * vi ) ; } } return ret ; |
public class ThreadUtils { /** * Determines whether the specified Thread is currently in a timed wait .
* @ param thread the Thread to evaluate .
* @ return a boolean value indicating whether the Thread is currently in a timed wait .
* @ see java . lang . Thread # getState ( )
* @ see java . lang . Thread . State # TIMED _ WAITING */
@ NullSafe public static boolean isTimedWaiting ( Thread thread ) { } } | return ( thread != null && Thread . State . TIMED_WAITING . equals ( thread . getState ( ) ) ) ; |
public class AbstractLoginServlet { /** * OAuth登录过程需要校验 < code > state < / code > 参数是否变化 。
* 默认情况下这个 < code > state < / code > 是调整到SSO登录时生成的随机码 , 如果这个状态被改变说明请求可能被篡改 。
* 校验通过返回 < code > true < / code > , 不通过返回false 。
* @ see # setOauth2LoginState ( HttpServletRequest , HttpServletResponse , String ) */
protected boolean checkOauth2LoginState ( HttpServletRequest req , HttpServletResponse resp ) throws IOException { } } | String state = req . getParameter ( "state" ) ; String sessionState = ( String ) req . getSession ( ) . getAttribute ( "oauth2_login_state" ) ; if ( ! Strings . equals ( sessionState , state ) ) { return false ; } return true ; |
public class Client { /** * Returns a list of bindings where provided exchange is the source ( other things are
* bound to it ) .
* @ param vhost vhost of the exchange
* @ param exchange source exchange name
* @ return list of bindings */
public List < BindingInfo > getBindingsBySource ( String vhost , String exchange ) { } } | final String x = exchange . equals ( "" ) ? "amq.default" : exchange ; final URI uri = uriWithPath ( "./exchanges/" + encodePathSegment ( vhost ) + "/" + encodePathSegment ( x ) + "/bindings/source" ) ; return Arrays . asList ( this . rt . getForObject ( uri , BindingInfo [ ] . class ) ) ; |
public class SimilarityQuery { /** * { @ inheritDoc } */
public Query rewrite ( IndexReader reader ) throws IOException { } } | MoreLikeThis more = new MoreLikeThis ( reader ) ; more . setAnalyzer ( analyzer ) ; more . setFieldNames ( new String [ ] { FieldNames . FULLTEXT } ) ; more . setMinWordLen ( 4 ) ; Query similarityQuery = null ; TermDocs td = reader . termDocs ( new Term ( FieldNames . UUID , uuid ) ) ; try { if ( td . next ( ) ) { similarityQuery = more . like ( td . doc ( ) ) ; } } finally { td . close ( ) ; } if ( similarityQuery != null ) { return similarityQuery . rewrite ( reader ) ; } else { // return dummy query that never matches
return new BooleanQuery ( ) ; } |
public class GeneralUtils { /** * This method is similar to { @ link # propX ( Expression , Expression ) } but will make sure that if the property
* being accessed is defined inside the classnode provided as a parameter , then a getter call is generated
* instead of a field access .
* @ param annotatedNode the class node where the property node is accessed from
* @ param pNode the property being accessed
* @ return a method call expression or a property expression */
public static Expression getterX ( ClassNode annotatedNode , PropertyNode pNode ) { } } | ClassNode owner = pNode . getDeclaringClass ( ) ; if ( annotatedNode . equals ( owner ) ) { String getterName = "get" + MetaClassHelper . capitalize ( pNode . getName ( ) ) ; if ( ClassHelper . boolean_TYPE . equals ( pNode . getOriginType ( ) ) ) { getterName = "is" + MetaClassHelper . capitalize ( pNode . getName ( ) ) ; } return callX ( new VariableExpression ( "this" ) , getterName , ArgumentListExpression . EMPTY_ARGUMENTS ) ; } return propX ( new VariableExpression ( "this" ) , pNode . getName ( ) ) ; |
public class FastqBuilder { /** * Return this FASTQ formatted sequence builder configured with the specified sequence .
* @ param sequence sequence for this FASTQ formatted sequence builder , must not be null
* @ return this FASTQ formatted sequence builder configured with the specified sequence */
public FastqBuilder withSequence ( final String sequence ) { } } | if ( sequence == null ) { throw new IllegalArgumentException ( "sequence must not be null" ) ; } if ( this . sequence == null ) { this . sequence = new StringBuilder ( sequence . length ( ) ) ; } this . sequence . replace ( 0 , this . sequence . length ( ) , sequence ) ; return this ; |
public class StorePackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EClass getRunServiceAuthorization ( ) { } } | if ( runServiceAuthorizationEClass == null ) { runServiceAuthorizationEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( StorePackage . eNS_URI ) . getEClassifiers ( ) . get ( 119 ) ; } return runServiceAuthorizationEClass ; |
public class ModificationQueue { /** * Checks if the given key is present for the given graph object in the modifiedProperties of this queue . < br > < br >
* This method is convenient if only one key has to be checked . If different
* actions should be taken for different keys one should rather use { @ link # getModifiedProperties } .
* Note : This method only works for regular properties , not relationship properties ( i . e . owner etc )
* @ param graphObject The GraphObject we are interested in
* @ param key The key to check
* @ return */
public boolean isPropertyModified ( final GraphObject graphObject , final PropertyKey key ) { } } | for ( GraphObjectModificationState state : getSortedModifications ( ) ) { for ( PropertyKey k : state . getModifiedProperties ( ) . keySet ( ) ) { if ( k . equals ( key ) && graphObject . getUuid ( ) . equals ( state . getGraphObject ( ) . getUuid ( ) ) ) { return true ; } } } return false ; |
public class DatatypeConverter { /** * Parse a string representation of a Boolean value .
* @ param value string representation
* @ return Boolean value */
public static Boolean parseBoolean ( String value ) throws ParseException { } } | Boolean result = null ; Integer number = parseInteger ( value ) ; if ( number != null ) { result = number . intValue ( ) == 0 ? Boolean . FALSE : Boolean . TRUE ; } return result ; |
public class CSSInputStream { /** * Sets a new encoding for the input stream . < b > Warning : < / b > this resets the stream
* i . e . a new connection is opened and all the data is read again .
* @ param enc The new encoding name .
* @ throws IOException */
public void setEncoding ( String enc ) throws IOException { } } | if ( source != null ) // applicapble to URL streams only
{ String current = encoding ; if ( current == null ) current = Charset . defaultCharset ( ) . name ( ) ; if ( ! current . equalsIgnoreCase ( enc ) ) { int oldindex = input . index ( ) ; source . close ( ) ; encoding = enc ; CSSInputStream newstream = urlStream ( url , network , encoding ) ; input = newstream . input ; input . seek ( oldindex ) ; } } |
public class JCudaDriver { /** * Set attributes on a previously allocated memory region < br >
* < br >
* The supported attributes are :
* < br >
* < ul >
* < li > CU _ POINTER _ ATTRIBUTE _ SYNC _ MEMOPS :
* A boolean attribute that can either be set ( 1 ) or unset ( 0 ) . When set ,
* the region of memory that ptr points to is guaranteed to always synchronize
* memory operations that are synchronous . If there are some previously initiated
* synchronous memory operations that are pending when this attribute is set , the
* function does not return until those memory operations are complete .
* See further documentation in the section titled " API synchronization behavior "
* to learn more about cases when synchronous memory operations can
* exhibit asynchronous behavior .
* value will be considered as a pointer to an unsigned integer to which this attribute is to be set .
* < / li >
* < / ul >
* @ param value Pointer to memory containing the value to be set
* @ param attribute Pointer attribute to set
* @ param ptr Pointer to a memory region allocated using CUDA memory allocation APIs
* @ return CUDA _ SUCCESS , CUDA _ ERROR _ DEINITIALIZED , CUDA _ ERROR _ NOT _ INITIALIZED ,
* CUDA _ ERROR _ INVALID _ CONTEXT , CUDA _ ERROR _ INVALID _ VALUE , CUDA _ ERROR _ INVALID _ DEVICE
* @ see JCudaDriver # cuPointerGetAttribute ,
* @ see JCudaDriver # cuPointerGetAttributes ,
* @ see JCudaDriver # cuMemAlloc ,
* @ see JCudaDriver # cuMemFree ,
* @ see JCudaDriver # cuMemAllocHost ,
* @ see JCudaDriver # cuMemFreeHost ,
* @ see JCudaDriver # cuMemHostAlloc ,
* @ see JCudaDriver # cuMemHostRegister ,
* @ see JCudaDriver # cuMemHostUnregister */
public static int cuPointerSetAttribute ( Pointer value , int attribute , CUdeviceptr ptr ) { } } | return checkResult ( cuPointerSetAttributeNative ( value , attribute , ptr ) ) ; |
public class BaasObject { /** * Asynchronously revoke the access < code > grant < / code > to this object from < code > username < / code > .
* The outcome of the request is handed to the provided < code > handler < / code > .
* @ param grant a non null { @ link com . baasbox . android . Grant }
* @ param username a non null username
* @ param handler an handler that will receive the outcome of the request .
* @ return a { @ link com . baasbox . android . RequestToken } to manage the asynchronous request */
public final RequestToken revoke ( Grant grant , String username , BaasHandler < Void > handler ) { } } | return grant ( grant , username , RequestOptions . DEFAULT , handler ) ; |
public class TodoItemElement { /** * - - - - - event handler */
private void toggle ( ) { } } | root . classList . toggle ( "completed" , toggle . checked ) ; repository . complete ( item , toggle . checked ) ; application . update ( ) ; |
public class WSManagedConnectionFactoryImpl { /** * This method is to be used by RRA code to set logwriter when needed */
final void reallySetLogWriter ( final PrintWriter out ) throws ResourceException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "setting the logWriter to:" , out ) ; if ( dataSourceOrDriver != null ) { try { AccessController . doPrivileged ( new PrivilegedExceptionAction < Void > ( ) { public Void run ( ) throws SQLException { if ( ! Driver . class . equals ( type ) ) { ( ( CommonDataSource ) dataSourceOrDriver ) . setLogWriter ( out ) ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "Unable to set logwriter on Driver type" ) ; } return null ; } } ) ; } catch ( PrivilegedActionException pae ) { SQLException se = ( SQLException ) pae . getCause ( ) ; FFDCFilter . processException ( se , getClass ( ) . getName ( ) , "593" , this ) ; throw AdapterUtil . translateSQLException ( se , this , false , getClass ( ) ) ; } } logWriter = out ; // Keep the value only if successful on the DataSource . |
public class ListTagsForResourceRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ListTagsForResourceRequest listTagsForResourceRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( listTagsForResourceRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( listTagsForResourceRequest . getResourceArn ( ) , RESOURCEARN_BINDING ) ; protocolMarshaller . marshall ( listTagsForResourceRequest . getLimit ( ) , LIMIT_BINDING ) ; protocolMarshaller . marshall ( listTagsForResourceRequest . getNextToken ( ) , NEXTTOKEN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class V1InstanceCreator { /** * Create a new Message with a subject and recipient .
* @ param subject Message subject .
* @ param messageBody Message body .
* @ param recipients Who this message will go to . May be null .
* @ param attributes additional attributes for the Message .
* @ return A newly minted Message that exists in the VersionOne system . */
public Message message ( String subject , String messageBody , Collection < Member > recipients , Map < String , Object > attributes ) { } } | Message message = new Message ( instance ) ; message . setName ( subject ) ; message . setDescription ( messageBody ) ; if ( recipients != null ) for ( Member recipient : recipients ) { message . getRecipients ( ) . add ( recipient ) ; } addAttributes ( message , attributes ) ; message . save ( ) ; return message ; |
public class StaticSentinel { /** * The offset defines how many methods of the same name are waiting . */
private synchronized static void waiting ( String classname , int fnr , int offset ) { } } | m . put ( classname , StaticOperationsCounters . waiting [ fnr ] += offset ) ; stateChanged ( ) ; |
public class CodingUtil { /** * Base64加密 url变种 , [ + 替换成 * ] [ / 替换成 _ ] */
public static String encryptToBase64Url ( String url ) { } } | url = encryptToBase64 ( url ) ; if ( url . indexOf ( "+" ) != - 1 ) { url = url . replaceAll ( "\\+" , "*" ) ; } if ( url . indexOf ( "/" ) != - 1 ) { url = url . replaceAll ( "/" , "_" ) ; } return url ; |
public class WrapperBucket { /** * Insert the specified object into the bucket and associate it with
* the specified key . Returns the Element which holds the newly -
* inserted object .
* @ param key key of the object element to be inserted .
* @ param object the object to be inserted for the specified key .
* @ return the Element holding the target object just inserted . */
public Element insertByKey ( Object key , Object object ) { } } | EJSWrapperCommon element = ( EJSWrapperCommon ) object ; if ( ivWrappers == null ) { ivWrappers = new HashMap < Object , EJSWrapperCommon > ( DEFAULT_BUCKET_SIZE ) ; } Object duplicate = ivWrappers . put ( key , element ) ; if ( duplicate != null ) { // The wrapper cache does not support duplicates . . . . however , the
// first time a home is looked up , and keyToObject faults it in ,
// deferred init will initialize it and insert it into the cache
// before returning to faultOnKey where it will be done AGAIN !
// In the future , it would be nice if deferred init would NOT
// add the home to the cache , but until then , it is fine to just
// ignore this and go on . . . . at least this code will only allow
// it in the cache once . d535968
if ( duplicate == element ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "insertByKey : same object again : " + object ) ; } else { // It is totally unacceptable to have more than one
// EJSWrapperCommon instance per key . d535968
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "insertByKey : attempt to insert duplicate : " + key + " : " + object + " : " + duplicate ) ; throw new IllegalArgumentException ( "Attempt to insert duplicate element into EJB Wrapper Cache" ) ; } } // Give the element ( EJSWrapperCommon ) access to the bucket , so it
// may syncronize on it , and also reset the pin count to 0,
// a non - negative , to indiate the element is now in the cache .
element . ivBucket = this ; element . pinned = 0 ; return element ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.