signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EClass getIfcRelAssignsToProjectOrder ( ) { } } | if ( ifcRelAssignsToProjectOrderEClass == null ) { ifcRelAssignsToProjectOrderEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 445 ) ; } return ifcRelAssignsToProjectOrderEClass ; |
public class SuffixTree { /** * Inserts the given suffix into this tree .
* @ param suffix The suffix to insert . */
void insert ( Suffix < I , S > suffix ) { } } | if ( activePoint . isNode ( ) ) { Node < I , S > node = activePoint . getNode ( ) ; node . insert ( suffix , activePoint ) ; } else if ( activePoint . isEdge ( ) ) { Edge < I , S > edge = activePoint . getEdge ( ) ; edge . insert ( suffix , activePoint ) ; } |
public class ReadOnlyStyledDocumentBuilder { /** * Constructs a list of paragraphs
* @ param segmentOps the { @ link SegmentOps } object to use for one of the { @ link Paragraph } ' s constructors
* @ param defaultParagraphStyle the paragraph style object to use when it is not specified in the
* " addParagraph " methods
* @ param configuration call the builder ' s { @ link # addParagraph ( Object , Object ) } methods here */
public static < PS , SEG , S > ReadOnlyStyledDocument < PS , SEG , S > constructDocument ( SegmentOps < SEG , S > segmentOps , PS defaultParagraphStyle , Consumer < ReadOnlyStyledDocumentBuilder < PS , SEG , S > > configuration ) { } } | ReadOnlyStyledDocumentBuilder < PS , SEG , S > builder = new ReadOnlyStyledDocumentBuilder < > ( segmentOps , defaultParagraphStyle ) ; configuration . accept ( builder ) ; return builder . build ( ) ; |
public class ELHelper { /** * This method will process a configuration value for an Integer setting in
* { @ link LdapIdentityStoreDefinition } or { @ link DatabaseIdentityStoreDefinition } .
* It will first check to see if there is an EL expression . It there is , it will return
* the evaluated expression ; otherwise , it
* will return the non - EL value .
* @ param name The name of the property . Used for error messages .
* @ param expression The EL expression returned from from the identity store definition .
* @ param value The non - EL value .
* @ param immediateOnly Return null if the value is a deferred EL expression .
* @ return Either the evaluated EL expression or the non - EL value . */
protected Integer processInt ( String name , String expression , int value , boolean immediateOnly ) { } } | Integer result = null ; boolean immediate = false ; /* * The expression language value takes precedence over the direct setting . */
if ( expression . isEmpty ( ) ) { /* * Direct setting . */
result = value ; } else { /* * Evaluate the EL expression to get the value . */
Object obj = evaluateElExpression ( expression ) ; if ( obj == null ) { throw new IllegalArgumentException ( "EL expression '" + expression + "' for '" + name + "'evaluated to null." ) ; } else if ( obj instanceof Number ) { result = ( ( Number ) obj ) . intValue ( ) ; immediate = isImmediateExpression ( expression ) ; } else { throw new IllegalArgumentException ( "Expected '" + name + "' to evaluate to an integer value." ) ; } } return ( immediateOnly && ! immediate ) ? null : result ; |
public class AVTrack { /** * Get the track ' s Codec _ ID field ( or null if this information is not available )
* @ return */
public String getCodecID ( ) { } } | final Element element = getElement ( "Codec_ID" , 0 ) ; if ( element != null ) return element . getText ( ) ; else return null ; |
public class DictTerm { /** * setter for enclosingSpan - sets span that this NoTerm is contained within ( i . e . its sentence )
* @ generated
* @ param v value to set into the feature */
public void setEnclosingSpan ( Annotation v ) { } } | if ( DictTerm_Type . featOkTst && ( ( DictTerm_Type ) jcasType ) . casFeat_enclosingSpan == null ) jcasType . jcas . throwFeatMissing ( "enclosingSpan" , "org.apache.uima.conceptMapper.DictTerm" ) ; jcasType . ll_cas . ll_setRefValue ( addr , ( ( DictTerm_Type ) jcasType ) . casFeatCode_enclosingSpan , jcasType . ll_cas . ll_getFSRef ( v ) ) ; |
public class Cells { /** * Extracts the Cell ( s ) associated to the default table _ NOT _ marked as partition key and _ NOT _ marked as cluster
* key .
* @ return the Cells object containing the subset of this Cells object of only the Cell ( s ) that are NOT part of the
* key . */
public Cells getValueCells ( ) { } } | Cells res = new Cells ( this . nameSpace ) ; for ( Map . Entry < String , List < Cell > > entry : cells . entrySet ( ) ) { Cells keys = getValueCells ( entry . getKey ( ) ) ; for ( Cell c : keys ) { res . add ( entry . getKey ( ) , c ) ; } } return res ; |
public class ContainerManagerTool { /** * Context related methods */
@ Override public void reloadContext ( ) throws DeploymentException { } } | Archive < ? > archive = mssContainer . getArchive ( ) ; deployableContainer . undeploy ( archive ) ; deployableContainer . deploy ( archive ) ; |
public class Immutables { /** * Wraps a key and value with an immutable { @ link Map . Entry } } . There is no copying involved .
* @ param key the key to wrap .
* @ param value the value to wrap .
* @ return an immutable { @ link Map . Entry } } wrapper that delegates to the original mapping . */
public static < K , V > Map . Entry < K , V > immutableEntry ( K key , V value ) { } } | return new ImmutableEntry < > ( key , value ) ; |
public class GloveChange { /** * Apply the changes to the table
* @ param table */
public void apply ( GloveWeightLookupTable table ) { } } | table . getBias ( ) . putScalar ( w1 . getIndex ( ) , table . getBias ( ) . getDouble ( w1 . getIndex ( ) ) - w1BiasUpdate ) ; table . getBias ( ) . putScalar ( w2 . getIndex ( ) , table . getBias ( ) . getDouble ( w2 . getIndex ( ) ) - w2BiasUpdate ) ; table . getSyn0 ( ) . slice ( w1 . getIndex ( ) ) . subi ( w1Update ) ; table . getSyn0 ( ) . slice ( w2 . getIndex ( ) ) . subi ( w2Update ) ; table . getWeightAdaGrad ( ) . getHistoricalGradient ( ) . slice ( w1 . getIndex ( ) ) . addi ( w1History ) ; table . getWeightAdaGrad ( ) . getHistoricalGradient ( ) . slice ( w2 . getIndex ( ) ) . addi ( w2History ) ; table . getBiasAdaGrad ( ) . getHistoricalGradient ( ) . putScalar ( w1 . getIndex ( ) , table . getBiasAdaGrad ( ) . getHistoricalGradient ( ) . getDouble ( w1 . getIndex ( ) ) + w1BiasHistory ) ; table . getBiasAdaGrad ( ) . getHistoricalGradient ( ) . putScalar ( w2 . getIndex ( ) , table . getBiasAdaGrad ( ) . getHistoricalGradient ( ) . getDouble ( w2 . getIndex ( ) ) + w1BiasHistory ) ; |
public class HiveAvroORCQueryGenerator { /** * Generate DDL query to create a Hive partition pointing at specific location .
* @ param dbName Hive database name .
* @ param tableName Hive table name .
* @ param partitionLocation Physical location of partition .
* @ param partitionsDMLInfo Partitions DML info - a map of partition name and partition value .
* @ param format Hive partition file format
* @ return Commands to create a partition . */
public static List < String > generateCreatePartitionDDL ( String dbName , String tableName , String partitionLocation , Map < String , String > partitionsDMLInfo , Optional < String > format ) { } } | if ( null == partitionsDMLInfo || partitionsDMLInfo . size ( ) == 0 ) { return Collections . emptyList ( ) ; } // Partition details
StringBuilder partitionSpecs = new StringBuilder ( ) ; partitionSpecs . append ( "PARTITION (" ) ; boolean isFirstPartitionSpec = true ; for ( Map . Entry < String , String > partition : partitionsDMLInfo . entrySet ( ) ) { if ( isFirstPartitionSpec ) { isFirstPartitionSpec = false ; } else { partitionSpecs . append ( ", " ) ; } partitionSpecs . append ( String . format ( "`%s`='%s'" , partition . getKey ( ) , partition . getValue ( ) ) ) ; } partitionSpecs . append ( ") \n" ) ; // Create statement
List < String > ddls = Lists . newArrayList ( ) ; // Note : Hive does not support fully qualified Hive table names such as db . table for ALTER TABLE in v0.13
// . . hence specifying ' use dbName ' as a precursor to rename
// Refer : HIVE - 2496
ddls . add ( String . format ( "USE %s%n" , dbName ) ) ; if ( format . isPresent ( ) ) { ddls . add ( String . format ( "ALTER TABLE `%s` ADD IF NOT EXISTS %s FILEFORMAT %s LOCATION '%s' " , tableName , partitionSpecs , format . get ( ) , partitionLocation ) ) ; } else { ddls . add ( String . format ( "ALTER TABLE `%s` ADD IF NOT EXISTS %s LOCATION '%s' " , tableName , partitionSpecs , partitionLocation ) ) ; } return ddls ; |
public class AtomContainer { /** * { @ inheritDoc } */
@ Override public Iterable < IBond > bonds ( ) { } } | return new Iterable < IBond > ( ) { @ Override public Iterator < IBond > iterator ( ) { return new BondIterator ( ) ; } } ; |
public class SibRaEngineComponent { /** * Registers a listener for active messaging engines on a bus .
* @ param listener
* the listener to register
* @ param busName
* the name of the bus the listener wishes to be informed about
* messaging engines for or < code > null < / code > if it wishes to
* know about all messaging engines
* @ return an array of the currently active messaging engines or an empty
* array if there are none */
public static JsMessagingEngine [ ] registerMessagingEngineListener ( final SibRaMessagingEngineListener listener , final String busName ) { } } | final String methodName = "registerMessagingEngineListener" ; if ( TRACE . isEntryEnabled ( ) ) { SibTr . entry ( TRACE , methodName , new Object [ ] { listener , busName } ) ; } final Set activeMessagingEngines = new HashSet ( ) ; /* * Take lock on active messaging engines to ensure that the activation
* of a messaging engine is reported once and once only either in the
* array returned from this method or by notification to the listener . */
synchronized ( ACTIVE_MESSAGING_ENGINES ) { synchronized ( MESSAGING_ENGINE_LISTENERS ) { // Add listener to map
Set listeners = ( Set ) MESSAGING_ENGINE_LISTENERS . get ( busName ) ; if ( listeners == null ) { listeners = new HashSet ( ) ; MESSAGING_ENGINE_LISTENERS . put ( busName , listeners ) ; } listeners . add ( listener ) ; } if ( busName == null ) { // Add all of the currently active messaging engines
for ( final Iterator iterator = ACTIVE_MESSAGING_ENGINES . values ( ) . iterator ( ) ; iterator . hasNext ( ) ; ) { final Set messagingEngines = ( Set ) iterator . next ( ) ; activeMessagingEngines . addAll ( messagingEngines ) ; } } else { // Add active messaging engines for the given bus if any
final Set messagingEngines = ( Set ) ACTIVE_MESSAGING_ENGINES . get ( busName ) ; if ( messagingEngines != null ) { activeMessagingEngines . addAll ( messagingEngines ) ; } } } final JsMessagingEngine [ ] result = ( JsMessagingEngine [ ] ) activeMessagingEngines . toArray ( new JsMessagingEngine [ activeMessagingEngines . size ( ) ] ) ; if ( TRACE . isEntryEnabled ( ) ) { SibTr . exit ( TRACE , methodName , result ) ; } return result ; |
public class GBSTree { /** * Pessimistic insert into a GBS Tree .
* @ param stack The InsertStack used to do the insert .
* @ param new1 The Object to be inserted .
* @ return optimisticWorked as this version always works . */
private synchronized boolean pessimisticInsert ( InsertStack stack , Object new1 ) { } } | _vno ++ ; if ( ( _vno & 1 ) == 1 ) { if ( root ( ) == null ) { addFirstNode ( new1 ) ; _population ++ ; } else { InsertNodes point = stack . insertNodes ( ) ; findInsert ( point , stack , new1 ) ; if ( point . isDuplicate ( ) ) stack . markDuplicate ( ) ; else { finishInsert ( point , stack , new1 ) ; _population ++ ; } } } synchronized ( stack ) { } _vno ++ ; _pessimisticInserts ++ ; return optimisticWorked ; |
public class RmiMessageConverter { /** * Reads Citrus internal RMI message model object from message payload . Either payload is actually a service invocation object or
* XML payload String is unmarshalled to proper object representation .
* @ param message
* @ param endpointConfiguration
* @ return */
private RmiServiceInvocation getServiceInvocation ( Message message , RmiEndpointConfiguration endpointConfiguration ) { } } | Object payload = message . getPayload ( ) ; RmiServiceInvocation serviceInvocation = null ; if ( payload != null ) { if ( payload instanceof RmiServiceInvocation ) { serviceInvocation = ( RmiServiceInvocation ) payload ; } else if ( payload != null && StringUtils . hasText ( message . getPayload ( String . class ) ) ) { serviceInvocation = ( RmiServiceInvocation ) endpointConfiguration . getMarshaller ( ) . unmarshal ( message . getPayload ( Source . class ) ) ; } else { serviceInvocation = new RmiServiceInvocation ( ) ; } } return serviceInvocation ; |
public class CreateLayerRequest { /** * A < code > VolumeConfigurations < / code > object that describes the layer ' s Amazon EBS volumes .
* @ return A < code > VolumeConfigurations < / code > object that describes the layer ' s Amazon EBS volumes . */
public java . util . List < VolumeConfiguration > getVolumeConfigurations ( ) { } } | if ( volumeConfigurations == null ) { volumeConfigurations = new com . amazonaws . internal . SdkInternalList < VolumeConfiguration > ( ) ; } return volumeConfigurations ; |
public class VelocityResponseTransformer { /** * Adds the request header information to the Velocity context .
* @ param headers the request headers */
private void addHeadersToContext ( final HttpHeaders headers ) { } } | for ( HttpHeader header : headers . all ( ) ) { final String rawKey = header . key ( ) ; final String transformedKey = rawKey . replaceAll ( "-" , "" ) ; context . put ( "requestHeader" . concat ( transformedKey ) , header . values ( ) . toString ( ) ) ; } |
public class FunctionTable { /** * Install a built - in function .
* @ param name The unqualified name of the function , must not be null
* @ param func A Implementation of an XPath Function object .
* @ return the position of the function in the internal index . */
public int installFunction ( String name , Class func ) { } } | int funcIndex ; Object funcIndexObj = getFunctionID ( name ) ; if ( null != funcIndexObj ) { funcIndex = ( ( Integer ) funcIndexObj ) . intValue ( ) ; if ( funcIndex < NUM_BUILT_IN_FUNCS ) { funcIndex = m_funcNextFreeIndex ++ ; m_functionID_customer . put ( name , new Integer ( funcIndex ) ) ; } m_functions_customer [ funcIndex - NUM_BUILT_IN_FUNCS ] = func ; } else { funcIndex = m_funcNextFreeIndex ++ ; m_functions_customer [ funcIndex - NUM_BUILT_IN_FUNCS ] = func ; m_functionID_customer . put ( name , new Integer ( funcIndex ) ) ; } return funcIndex ; |
public class ValidateXMLInterceptor { /** * Paint the original XML wrapped in a CDATA Section .
* @ param originalXML the original XML
* @ param writer the output writer */
private void paintOriginalXML ( final String originalXML , final PrintWriter writer ) { } } | // Replace any CDATA Sections embedded in XML
String xml = originalXML . replaceAll ( "<!\\[CDATA\\[" , "CDATASTART" ) ; xml = xml . replaceAll ( "\\]\\]>" , "CDATAFINISH" ) ; // Paint Output
writer . println ( "<div>" ) ; writer . println ( "<!-- VALIDATE XML ERROR - START XML -->" ) ; writer . println ( "<![CDATA[" ) ; writer . println ( xml ) ; writer . println ( "]]>" ) ; writer . println ( "<!-- VALIDATE XML ERROR - END XML -->" ) ; writer . println ( "</div>" ) ; |
public class StringBindingListener { /** * Update the underlying model object .
* @ param event
* the event */
protected void update ( DocumentEvent event ) { } } | String text ; try { text = event . getDocument ( ) . getText ( event . getDocument ( ) . getStartPosition ( ) . getOffset ( ) , event . getDocument ( ) . getEndPosition ( ) . getOffset ( ) - 1 ) ; model . setObject ( text ) ; } catch ( BadLocationException e1 ) { log . log ( Level . SEVERE , "some portion of the given range was not a valid part of the document. " + "The location in the exception is the first bad position encountered." , e1 ) ; } |
public class CallStackReader { /** * Get the call stack via the SecurityManager API .
* @ param log
* the log
* @ return the call stack . */
private static Class < ? > [ ] getCallStackViaSecurityManager ( final LogNode log ) { } } | try { return new CallerResolver ( ) . getClassContext ( ) ; } catch ( final SecurityException e ) { // Creating a SecurityManager can fail if the current SecurityManager does not allow
// RuntimePermission ( " createSecurityManager " )
if ( log != null ) { log . log ( "Exception while trying to obtain call stack via SecurityManager" , e ) ; } return null ; } |
public class MeasurementUnitsImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public void eUnset ( int featureID ) { } } | switch ( featureID ) { case AfplibPackage . MEASUREMENT_UNITS__XOA_BASE : setXoaBase ( XOA_BASE_EDEFAULT ) ; return ; case AfplibPackage . MEASUREMENT_UNITS__YOA_BASE : setYoaBase ( YOA_BASE_EDEFAULT ) ; return ; case AfplibPackage . MEASUREMENT_UNITS__XOA_UNITS : setXoaUnits ( XOA_UNITS_EDEFAULT ) ; return ; case AfplibPackage . MEASUREMENT_UNITS__YOA_UNITS : setYoaUnits ( YOA_UNITS_EDEFAULT ) ; return ; } super . eUnset ( featureID ) ; |
public class EnhancedDebuggerWindow { /** * Notification that the connection was closed due to an exception .
* @ param debugger the debugger whose connection was closed due to an exception .
* @ param e the exception . */
static synchronized void connectionClosedOnError ( EnhancedDebugger debugger , Exception e ) { } } | int index = getInstance ( ) . tabbedPane . indexOfComponent ( debugger . tabbedPane ) ; getInstance ( ) . tabbedPane . setToolTipTextAt ( index , "XMPPConnection closed due to the exception: " + e . getMessage ( ) ) ; getInstance ( ) . tabbedPane . setIconAt ( index , connectionClosedOnErrorIcon ) ; |
public class ChannelFrameworkImpl { /** * @ seecom . ibm . wsspi . channelfw . ChannelFramework # addChainEventListener (
* ChainEventListener , String ) */
@ Override public synchronized void addChainEventListener ( ChainEventListener cel , String chainName ) throws InvalidChainNameException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "addChainEventListener: chain=" + chainName + " listener=" + cel ) ; } ChainDataImpl chainData = null ; if ( null == chainName ) { InvalidChainNameException e = new InvalidChainNameException ( "Unable to register a listener for a chain with null name" ) ; // Race condition can occur where chain is stopped before we register the listener , no need to FFDC
// FFDCFilter . processException ( e , getClass ( ) . getName ( ) + " . addChainEventListener " , " 2910 " , this , new Object [ ] { chainName , this } ) ;
throw e ; } // Handle a listener registering for events from all chains .
if ( chainName . equals ( ChainEventListener . ALL_CHAINS ) ) { for ( ChainData chain : this . chainDataMap . values ( ) ) { ( ( ChainDataImpl ) chain ) . addChainEventListener ( cel ) ; } this . globalChainEventListeners . add ( cel ) ; } else { // Extract the chain config from the framework .
chainData = this . chainDataMap . get ( chainName ) ; // Verify the chain config is in the framework
if ( null == chainData ) { InvalidChainNameException e = new InvalidChainNameException ( "Unable to register listener for unknown chain config, " + chainName ) ; // Race condition can occur where chain is stopped before we register the listener , no need to FFDC
// FFDCFilter . processException ( e , getClass ( ) . getName ( ) + " . addChainEventListener " , " 2910 " , this , new Object [ ] { chainName , this } ) ;
throw e ; } chainData . addChainEventListener ( cel ) ; } |
public class UserAttrs { /** * Set user - defined - attribute
* @ param path
* @ param attribute user : attribute name . user : can be omitted .
* @ param value
* @ param options
* @ throws IOException */
public static final void setStringAttribute ( Path path , String attribute , String value , LinkOption ... options ) throws IOException { } } | attribute = attribute . startsWith ( "user:" ) ? attribute : "user:" + attribute ; if ( value != null ) { Files . setAttribute ( path , attribute , value . getBytes ( UTF_8 ) , options ) ; } else { Files . setAttribute ( path , attribute , null , options ) ; } |
public class TransactionHandler { /** * Release this transaction and frees all allocated resources . */
protected void release ( ) { } } | stack . getLocalTransactions ( ) . remove ( Integer . valueOf ( localTID ) ) ; stack . getRemoteTxToLocalTxMap ( ) . remove ( Integer . valueOf ( remoteTID ) ) ; cancelTHISTTimerTask ( ) ; cancelLongtranTimer ( ) ; cancelReTransmissionTimer ( ) ; if ( originalPacket != null ) stack . releasePacket ( originalPacket ) ; originalPacket = null ; |
public class SyncGroupsInner { /** * Gets a collection of sync database ids .
* ServiceResponse < PageImpl < SyncDatabaseIdPropertiesInner > > * @ param locationName The name of the region where the resource is located .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the PagedList & lt ; SyncDatabaseIdPropertiesInner & gt ; object wrapped in { @ link ServiceResponse } if successful . */
public Observable < ServiceResponse < Page < SyncDatabaseIdPropertiesInner > > > listSyncDatabaseIdsSinglePageAsync ( final String locationName ) { } } | if ( locationName == null ) { throw new IllegalArgumentException ( "Parameter locationName is required and cannot be null." ) ; } if ( this . client . subscriptionId ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.subscriptionId() is required and cannot be null." ) ; } if ( this . client . apiVersion ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.apiVersion() is required and cannot be null." ) ; } return service . listSyncDatabaseIds ( locationName , this . client . subscriptionId ( ) , this . client . apiVersion ( ) , this . client . acceptLanguage ( ) , this . client . userAgent ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < ServiceResponse < Page < SyncDatabaseIdPropertiesInner > > > > ( ) { @ Override public Observable < ServiceResponse < Page < SyncDatabaseIdPropertiesInner > > > call ( Response < ResponseBody > response ) { try { ServiceResponse < PageImpl < SyncDatabaseIdPropertiesInner > > result = listSyncDatabaseIdsDelegate ( response ) ; return Observable . just ( new ServiceResponse < Page < SyncDatabaseIdPropertiesInner > > ( result . body ( ) , result . response ( ) ) ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ; |
public class N { /** * @ see Arrays # copyOf ( Object [ ] , int , Class )
* @ param original
* @ param newLength
* @ return */
public static < T , U > T [ ] copyOf ( final U [ ] original , final int newLength , final Class < ? extends T [ ] > newType ) { } } | final T [ ] copy = Object [ ] . class . equals ( newType ) ? ( T [ ] ) new Object [ newLength ] : ( T [ ] ) N . newArray ( newType . getComponentType ( ) , newLength ) ; if ( N . notNullOrEmpty ( original ) ) { copy ( original , 0 , copy , 0 , Math . min ( original . length , newLength ) ) ; } return copy ; |
public class PersistenceDelegate { /** * Determines whether one object mutates to the other object . One object is considered able to mutate to another object if they are indistinguishable in
* terms of behaviors of all public APIs . The default implementation here is to return true only if the two objects are instances of the same class .
* @ param o1
* one object
* @ param o2
* the other object
* @ return true if second object mutates to the first object , otherwise false */
protected boolean mutatesTo ( Object o1 , Object o2 ) { } } | return null != o1 && null != o2 && o1 . getClass ( ) == o2 . getClass ( ) ; |
public class UtilsUml { /** * Algorithm # 1:
* 1 . Find out set of 0 - level super - classes , i . e . they has no super - classes .
* All other classes level is settled to 999
* 2 . For each of 0 - level ( Y ) class go through its sub - classes to last - level sub - class and evaluate count of levels ( Y ) .
* In this phase also conduct level of classes that has no extends | implements relations
* 3 . Sort classes according levelX - levelY , then go through them and set its startPoint
* 4 . Adjust relations joint points
* @ param classList
* @ param umlGraphParams */
public static < CL extends ClassUml > void arrangeClassDiagram ( List < ClassFull < CL > > classList , SettingsGraphicUml gp , int algorithmId ) { } } | // 1 . Find out set of 0 - level super - classes , i . e . they has no super - classes .
// All other classes level is settled to 999:
List < ClassFull < CL > > topLevelSuperClasses = new ArrayList < ClassFull < CL > > ( ) ; double levelX = 0 ; double fakeLevel = - 999d ; for ( ClassFull < CL > clsRel : classList ) { clsRel . getShape ( ) . setIsPrepared ( false ) ; clsRel . getShape ( ) . setLevelXOnDiagram ( fakeLevel ) ; clsRel . getShape ( ) . setLevelYOnDiagram ( fakeLevel ) ; } for ( ClassFull < CL > clsRel : classList ) { int relationCountAsSuperclass = 0 ; for ( ClassRelationFull < CL > classRelation : clsRel . getRelationshipsBinary ( ) ) { if ( classRelation . getClassRelationship ( ) . getEndType ( ) == ERelationshipEndType . END && ( classRelation . getRelationship ( ) . getItsKind ( ) == ERelationshipKind . GENERALIZATION || classRelation . getRelationship ( ) . getItsKind ( ) == ERelationshipKind . REALIZATION || classRelation . getRelationship ( ) . getItsKind ( ) == ERelationshipKind . INTERFACE_REALIZATION ) ) { relationCountAsSuperclass ++ ; } } if ( relationCountAsSuperclass == clsRel . getRelationshipsBinary ( ) . size ( ) ) { // there is only subclasses
clsRel . getShape ( ) . setIsPrepared ( true ) ; clsRel . getShape ( ) . setLevelXOnDiagram ( levelX ++ ) ; clsRel . getShape ( ) . setLevelYOnDiagram ( 0d ) ; topLevelSuperClasses . add ( clsRel ) ; } } // 2 . For each of 0 - level ( Y ) class go through its sub - classes to last - level sub - class and evaluate count of levels ( Y ) .
// In this phase also conduct level of classes that has no extends | implements relations
Double countLevelY = 1d ; for ( ClassFull < CL > clsRel : topLevelSuperClasses ) { countLevelY = Math . max ( countLevelY , calculateUmlClassRelationsLevels ( clsRel , classList ) ) ; } // correction :
levelX = 0 ; setIsPreparedForClasses ( classList , false ) ; for ( ClassFull < CL > clsRel : classList ) { boolean isWhereFake = false ; if ( clsRel . getShape ( ) . getLevelXOnDiagram ( ) . equals ( fakeLevel ) ) { clsRel . getShape ( ) . setLevelXOnDiagram ( levelX ++ ) ; isWhereFake = true ; } if ( clsRel . getShape ( ) . getLevelYOnDiagram ( ) . equals ( fakeLevel ) ) { clsRel . getShape ( ) . setLevelYOnDiagram ( countLevelY ) ; isWhereFake = true ; } if ( isWhereFake ) { countLevelY = Math . max ( countLevelY , calculateUmlClassRelationsLevels ( clsRel , classList ) ) ; } } // 3 . Sort classes according levelX - levelY , then go through them and set its startPoint :
Collections . sort ( classList , new ComparatorClassFullLevel < CL > ( ) ) ; // location parameters :
double [ ] bottomOfLevelY = new double [ countLevelY . intValue ( ) ] ; double [ ] rightOfLevelY = new double [ countLevelY . intValue ( ) ] ; double [ ] countClassOnLevelY = new double [ countLevelY . intValue ( ) ] ; // a : first cycle arrange and remember location parameters
ClassFull < CL > prevCre = null ; double x ; double y ; for ( ClassFull < CL > clsRel : classList ) { if ( prevCre == null ) { x = y = gp . getMarginDiagram ( ) ; } else { if ( clsRel . getShape ( ) . getLevelYOnDiagram ( ) . equals ( prevCre . getShape ( ) . getLevelYOnDiagram ( ) ) ) { if ( ! clsRel . getShape ( ) . getLevelXOnDiagram ( ) . equals ( prevCre . getShape ( ) . getLevelXOnDiagram ( ) ) ) { x = prevCre . getShape ( ) . getPointStart ( ) . getX ( ) + prevCre . getShape ( ) . getWidth ( ) + gp . getGapDiagram ( ) ; } else { // e . g . more than two associations
x = prevCre . getShape ( ) . getPointStart ( ) . getX ( ) ; } } else { x = gp . getMarginDiagram ( ) ; } if ( prevCre != null && clsRel . getShape ( ) . getLevelYOnDiagram ( ) . equals ( prevCre . getShape ( ) . getLevelYOnDiagram ( ) ) && clsRel . getShape ( ) . getLevelXOnDiagram ( ) . equals ( prevCre . getShape ( ) . getLevelXOnDiagram ( ) ) ) { // e . g . more than two associations
y = prevCre . getShape ( ) . getPointStart ( ) . getY ( ) + prevCre . getShape ( ) . getHeight ( ) + gp . getGapDiagram ( ) / 2 ; } else if ( clsRel . getShape ( ) . getLevelYOnDiagram ( ) . intValue ( ) == 0 ) { y = gp . getMarginDiagram ( ) ; } else { y = bottomOfLevelY [ clsRel . getShape ( ) . getLevelYOnDiagram ( ) . intValue ( ) - 1 ] + gp . getGapDiagram ( ) ; } } clsRel . getShape ( ) . getPointStart ( ) . setX ( x ) ; clsRel . getShape ( ) . getPointStart ( ) . setY ( y ) ; evalJointPoints ( clsRel ) ; prevCre = clsRel ; bottomOfLevelY [ clsRel . getShape ( ) . getLevelYOnDiagram ( ) . intValue ( ) ] = Math . max ( bottomOfLevelY [ clsRel . getShape ( ) . getLevelYOnDiagram ( ) . intValue ( ) ] , y + clsRel . getShape ( ) . getHeight ( ) ) ; rightOfLevelY [ clsRel . getShape ( ) . getLevelYOnDiagram ( ) . intValue ( ) ] = Math . max ( rightOfLevelY [ clsRel . getShape ( ) . getLevelYOnDiagram ( ) . intValue ( ) ] , x + clsRel . getShape ( ) . getWidth ( ) ) ; countClassOnLevelY [ clsRel . getShape ( ) . getLevelYOnDiagram ( ) . intValue ( ) ] ++ ; } // b : second cycle adjust position according location parameters
double maxX = 0 ; double levelYwithMaxX = 0 ; for ( int i = 0 ; i < rightOfLevelY . length ; i ++ ) { if ( maxX < rightOfLevelY [ i ] ) { maxX = rightOfLevelY [ i ] ; levelYwithMaxX = i ; } } for ( ClassFull < CL > clsRel : classList ) { if ( clsRel . getShape ( ) . getLevelYOnDiagram ( ) . intValue ( ) == 0 ) { // Adjust y to be in the bottom of first row :
y = clsRel . getShape ( ) . getPointStart ( ) . getY ( ) ; double rowHeight = bottomOfLevelY [ clsRel . getShape ( ) . getLevelYOnDiagram ( ) . intValue ( ) ] - y ; y = y + rowHeight - clsRel . getShape ( ) . getHeight ( ) ; clsRel . getShape ( ) . getPointStart ( ) . setY ( y ) ; } else if ( clsRel . getShape ( ) . getLevelYOnDiagram ( ) . intValue ( ) != bottomOfLevelY . length - 1 ) { // Adjust y to be in the middle of its row :
y = clsRel . getShape ( ) . getPointStart ( ) . getY ( ) ; double rowHeight = bottomOfLevelY [ clsRel . getShape ( ) . getLevelYOnDiagram ( ) . intValue ( ) ] - y ; y = y + ( rowHeight - clsRel . getShape ( ) . getHeight ( ) ) / 2 ; clsRel . getShape ( ) . getPointStart ( ) . setY ( y ) ; } if ( clsRel . getShape ( ) . getLevelYOnDiagram ( ) != levelYwithMaxX ) { // Adjust x to be row center
double lenthToAdjust = ( maxX - rightOfLevelY [ clsRel . getShape ( ) . getLevelYOnDiagram ( ) . intValue ( ) ] ) / 2 ; clsRel . getShape ( ) . getPointStart ( ) . setX ( clsRel . getShape ( ) . getPointStart ( ) . getX ( ) + lenthToAdjust ) ; } evalJointPoints ( clsRel ) ; } // 4 Adjust relations joint points :
setIsPreparedForClasses ( classList , false ) ; adjustRelationPointsSideAndToCenter ( gp , classList ) ; setIsPreparedForClasses ( classList , false ) ; for ( ClassFull < CL > clsRel : classList ) { readjustRelationPoints ( gp , clsRel ) ; } setIsPreparedForClasses ( classList , false ) ; |
public class Cache { /** * 判断 member 元素是否集合 key 的成员 。 */
public boolean sismember ( Object key , Object member ) { } } | Jedis jedis = getJedis ( ) ; try { return jedis . sismember ( keyToBytes ( key ) , valueToBytes ( member ) ) ; } finally { close ( jedis ) ; } |
public class CouchDBObjectMapper { /** * Gets the json object .
* @ param declaredFields
* the declared fields
* @ param embeddableType
* the embeddable type
* @ param embeddedObject
* the embedded object
* @ return the json object */
private static JsonElement getJsonObject ( Field [ ] declaredFields , EmbeddableType embeddableType , Object embeddedObject ) { } } | JsonObject jsonObject = new JsonObject ( ) ; for ( Field field : declaredFields ) { if ( ! ReflectUtils . isTransientOrStatic ( field ) && ! embeddableType . getAttribute ( field . getName ( ) ) . isAssociation ( ) ) { Object valueObject = PropertyAccessorHelper . getObject ( embeddedObject , field ) ; jsonObject . add ( ( ( AbstractAttribute ) ( embeddableType . getAttribute ( field . getName ( ) ) ) ) . getJPAColumnName ( ) , getJsonPrimitive ( valueObject , embeddableType . getAttribute ( field . getName ( ) ) . getJavaType ( ) ) ) ; } } return jsonObject ; |
public class Layout { /** * Get the table name . */
public String getTableNames ( boolean bAddQuotes ) { } } | return ( m_tableName == null ) ? Record . formatTableNames ( LAYOUT_FILE , bAddQuotes ) : super . getTableNames ( bAddQuotes ) ; |
public class FJIterate { /** * Same effect as { @ link Iterate # collect ( Iterable , Function ) } , but executed in parallel batches ,
* and writing output into the specified collection .
* @ param target Where to write the output .
* @ param allowReorderedResult If the result can be in a different order .
* Allowing reordering may yield faster execution .
* @ return The ' target ' collection , with the collected elements added . */
public static < T , V , R extends Collection < V > > R collect ( Iterable < T > iterable , Function < ? super T , V > function , R target , boolean allowReorderedResult ) { } } | return FJIterate . collect ( iterable , function , target , FJIterate . DEFAULT_MIN_FORK_SIZE , FJIterate . FORK_JOIN_POOL , allowReorderedResult ) ; |
public class CmsLinkRewriter { /** * Reads the resources in a subtree . < p >
* @ param rootPath the root of the subtree
* @ return the list of resources from the subtree
* @ throws CmsException if something goes wrong */
protected List < CmsResource > readTree ( String rootPath ) throws CmsException { } } | rootPath = CmsFileUtil . removeTrailingSeparator ( rootPath ) ; CmsResource base = m_cms . readResource ( rootPath ) ; I_CmsResourceType resType = OpenCms . getResourceManager ( ) . getResourceType ( base ) ; List < CmsResource > result = new ArrayList < CmsResource > ( ) ; if ( resType . isFolder ( ) ) { rootPath = CmsStringUtil . joinPaths ( rootPath , "/" ) ; List < CmsResource > subResources = m_cms . readResources ( rootPath , CmsResourceFilter . ALL , true ) ; result . add ( base ) ; result . addAll ( subResources ) ; } else { result . add ( base ) ; } for ( CmsResource resource : result ) { m_cachedResources . put ( resource . getStructureId ( ) , resource ) ; } return result ; |
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EClass getIfcSolarDeviceType ( ) { } } | if ( ifcSolarDeviceTypeEClass == null ) { ifcSolarDeviceTypeEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 608 ) ; } return ifcSolarDeviceTypeEClass ; |
public class XmJvmSecurityUtils { /** * If JVM security manager exists then checks JVM security ' control ' permission . */
public static void checkSecurity ( ) { } } | SecurityManager securityManager = System . getSecurityManager ( ) ; if ( securityManager != null ) { securityManager . checkPermission ( new ManagementPermission ( PERMISSION_NAME_CONTROL ) ) ; } |
public class AbstractCanalAdapterWorker { /** * 分批同步
* @ param dmls
* @ param adapter */
private void batchSync ( List < Dml > dmls , OuterAdapter adapter ) { } } | // 分批同步
if ( dmls . size ( ) <= canalClientConfig . getSyncBatchSize ( ) ) { adapter . sync ( dmls ) ; } else { int len = 0 ; List < Dml > dmlsBatch = new ArrayList < > ( ) ; for ( Dml dml : dmls ) { dmlsBatch . add ( dml ) ; if ( dml . getData ( ) == null || dml . getData ( ) . isEmpty ( ) ) { len += 1 ; } else { len += dml . getData ( ) . size ( ) ; } if ( len >= canalClientConfig . getSyncBatchSize ( ) ) { adapter . sync ( dmlsBatch ) ; dmlsBatch . clear ( ) ; len = 0 ; } } if ( ! dmlsBatch . isEmpty ( ) ) { adapter . sync ( dmlsBatch ) ; } } |
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link TimePositionType } { @ code > }
* @ param value
* Java instance representing xml element ' s value .
* @ return
* the new instance of { @ link JAXBElement } { @ code < } { @ link TimePositionType } { @ code > } */
@ XmlElementDecl ( namespace = "http://www.opengis.net/gml" , name = "timePosition" ) public JAXBElement < TimePositionType > createTimePosition ( TimePositionType value ) { } } | return new JAXBElement < TimePositionType > ( _TimePosition_QNAME , TimePositionType . class , null , value ) ; |
public class CPDefinitionOptionRelPersistenceImpl { /** * Returns the last cp definition option rel in the ordered set where CPDefinitionId = & # 63 ; and skuContributor = & # 63 ; .
* @ param CPDefinitionId the cp definition ID
* @ param skuContributor the sku contributor
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the last matching cp definition option rel , or < code > null < / code > if a matching cp definition option rel could not be found */
@ Override public CPDefinitionOptionRel fetchByC_SC_Last ( long CPDefinitionId , boolean skuContributor , OrderByComparator < CPDefinitionOptionRel > orderByComparator ) { } } | int count = countByC_SC ( CPDefinitionId , skuContributor ) ; if ( count == 0 ) { return null ; } List < CPDefinitionOptionRel > list = findByC_SC ( CPDefinitionId , skuContributor , count - 1 , count , orderByComparator ) ; if ( ! list . isEmpty ( ) ) { return list . get ( 0 ) ; } return null ; |
public class SampleReader { /** * Make the request to the Twilio API to perform the read .
* @ param client TwilioRestClient with which to make the request
* @ return Sample ResourceSet */
@ Override public ResourceSet < Sample > read ( final TwilioRestClient client ) { } } | return new ResourceSet < > ( this , client , firstPage ( client ) ) ; |
public class SimpleTaskMapper { /** * This method maps a { @ link WorkflowTask } of type { @ link TaskType # SIMPLE }
* to a { @ link Task }
* @ param taskMapperContext : A wrapper class containing the { @ link WorkflowTask } , { @ link WorkflowDef } , { @ link Workflow } and a string representation of the TaskId
* @ throws TerminateWorkflowException In case if the task definition does not exist
* @ return : a List with just one simple task */
@ Override public List < Task > getMappedTasks ( TaskMapperContext taskMapperContext ) throws TerminateWorkflowException { } } | logger . debug ( "TaskMapperContext {} in SimpleTaskMapper" , taskMapperContext ) ; WorkflowTask taskToSchedule = taskMapperContext . getTaskToSchedule ( ) ; Workflow workflowInstance = taskMapperContext . getWorkflowInstance ( ) ; int retryCount = taskMapperContext . getRetryCount ( ) ; String retriedTaskId = taskMapperContext . getRetryTaskId ( ) ; TaskDef taskDefinition = Optional . ofNullable ( taskToSchedule . getTaskDefinition ( ) ) . orElseThrow ( ( ) -> { String reason = String . format ( "Invalid task. Task %s does not have a definition" , taskToSchedule . getName ( ) ) ; return new TerminateWorkflowException ( reason ) ; } ) ; Map < String , Object > input = parametersUtils . getTaskInput ( taskToSchedule . getInputParameters ( ) , workflowInstance , taskDefinition , taskMapperContext . getTaskId ( ) ) ; Task simpleTask = new Task ( ) ; simpleTask . setStartDelayInSeconds ( taskToSchedule . getStartDelay ( ) ) ; simpleTask . setTaskId ( taskMapperContext . getTaskId ( ) ) ; simpleTask . setReferenceTaskName ( taskToSchedule . getTaskReferenceName ( ) ) ; simpleTask . setInputData ( input ) ; simpleTask . setWorkflowInstanceId ( workflowInstance . getWorkflowId ( ) ) ; simpleTask . setWorkflowType ( workflowInstance . getWorkflowName ( ) ) ; simpleTask . setStatus ( Task . Status . SCHEDULED ) ; simpleTask . setTaskType ( taskToSchedule . getName ( ) ) ; simpleTask . setTaskDefName ( taskToSchedule . getName ( ) ) ; simpleTask . setCorrelationId ( workflowInstance . getCorrelationId ( ) ) ; simpleTask . setScheduledTime ( System . currentTimeMillis ( ) ) ; simpleTask . setRetryCount ( retryCount ) ; simpleTask . setCallbackAfterSeconds ( taskToSchedule . getStartDelay ( ) ) ; simpleTask . setResponseTimeoutSeconds ( taskDefinition . getResponseTimeoutSeconds ( ) ) ; simpleTask . setWorkflowTask ( taskToSchedule ) ; simpleTask . setRetriedTaskId ( retriedTaskId ) ; return Collections . singletonList ( simpleTask ) ; |
public class Alarm { /** * Queue the alarm for wakeup .
* @ param delta time in milliseconds to wake */
public void runAfter ( long delta ) { } } | long now = CurrentTime . getExactTime ( ) ; // boolean isNotify = _ heap . queueAt ( this , now + delta ) ;
boolean isNotify = _clock . queueAt ( this , now + delta ) ; if ( isNotify ) { _coordinatorThread . wake ( ) ; } |
public class ClimberResetCountMin4 { /** * Reduces every counter by half of its original value . To reduce the truncation
* error , the sample is reduced by the number of counters with an odd value . */
@ Override protected void tryReset ( boolean added ) { } } | additions += step ; if ( ! added ) { return ; } if ( additions < period ) { return ; } int count = 0 ; for ( int i = 0 ; i < table . length ; i ++ ) { count += Long . bitCount ( table [ i ] & ONE_MASK ) ; table [ i ] = ( table [ i ] >>> 1 ) & RESET_MASK ; } additions = ( additions >>> 1 ) - ( count >>> 2 ) ; doorkeeper . clear ( ) ; |
public class JavacHandlerUtil { /** * Turns an { @ code AccessLevel } instance into the flag bit used by javac . */
public static int toJavacModifier ( AccessLevel accessLevel ) { } } | switch ( accessLevel ) { case MODULE : case PACKAGE : return 0 ; default : case PUBLIC : return Flags . PUBLIC ; case NONE : case PRIVATE : return Flags . PRIVATE ; case PROTECTED : return Flags . PROTECTED ; } |
public class Padding { /** * Allows to set Table ' s padding with the Padding object , which has be done externally , as it ' s not part
* of the standard libGDX API .
* @ param padding contains data of padding sizes .
* @ param table will have the padding set according to the given data .
* @ return the given table for chaining . */
public static Table setPadding ( final Padding padding , final Table table ) { } } | table . pad ( padding . getTop ( ) , padding . getLeft ( ) , padding . getBottom ( ) , padding . getRight ( ) ) ; return table ; |
public class SSHLauncher { /** * { @ inheritDoc } */
@ Override public void launch ( final SlaveComputer computer , final TaskListener listener ) throws InterruptedException { } } | final Node node = computer . getNode ( ) ; final String host = this . host ; final int port = this . port ; checkConfig ( ) ; synchronized ( this ) { connection = new Connection ( host , port ) ; launcherExecutorService = Executors . newSingleThreadExecutor ( new NamingThreadFactory ( Executors . defaultThreadFactory ( ) , "SSHLauncher.launch for '" + computer . getName ( ) + "' node" ) ) ; Set < Callable < Boolean > > callables = new HashSet < > ( ) ; callables . add ( new Callable < Boolean > ( ) { public Boolean call ( ) throws InterruptedException { Boolean rval = Boolean . FALSE ; try { String [ ] preferredKeyAlgorithms = getSshHostKeyVerificationStrategyDefaulted ( ) . getPreferredKeyAlgorithms ( computer ) ; if ( preferredKeyAlgorithms != null && preferredKeyAlgorithms . length > 0 ) { // JENKINS - 44832
connection . setServerHostKeyAlgorithms ( preferredKeyAlgorithms ) ; } else { listener . getLogger ( ) . println ( "Warning: no key algorithms provided; JENKINS-42959 disabled" ) ; } listener . getLogger ( ) . println ( logConfiguration ( ) ) ; openConnection ( listener , computer ) ; verifyNoHeaderJunk ( listener ) ; reportEnvironment ( listener ) ; final String workingDirectory = getWorkingDirectory ( computer ) ; if ( workingDirectory == null ) { listener . error ( "Cannot get the working directory for " + computer ) ; return Boolean . FALSE ; } String java = null ; if ( StringUtils . isNotBlank ( javaPath ) ) { java = expandExpression ( computer , javaPath ) ; } else { JavaVersionChecker javaVersionChecker = new JavaVersionChecker ( computer , listener , getJvmOptions ( ) , connection ) ; java = javaVersionChecker . resolveJava ( ) ; } copyAgentJar ( listener , workingDirectory ) ; startAgent ( computer , listener , java , workingDirectory ) ; PluginImpl . register ( connection ) ; rval = Boolean . TRUE ; } catch ( RuntimeException e ) { e . printStackTrace ( listener . error ( Messages . SSHLauncher_UnexpectedError ( ) ) ) ; } catch ( Error e ) { e . printStackTrace ( listener . error ( Messages . SSHLauncher_UnexpectedError ( ) ) ) ; } catch ( AbortException e ) { listener . getLogger ( ) . println ( e . getMessage ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( listener . getLogger ( ) ) ; } finally { return rval ; } } } ) ; final String nodeName = node != null ? node . getNodeName ( ) : "unknown" ; try { long time = System . currentTimeMillis ( ) ; List < Future < Boolean > > results ; final ExecutorService srv = launcherExecutorService ; if ( srv == null ) { throw new IllegalStateException ( "Launcher Executor Service should be always non-null here, because the task allocates and closes service on its own" ) ; } if ( this . getLaunchTimeoutMillis ( ) > 0 ) { results = srv . invokeAll ( callables , this . getLaunchTimeoutMillis ( ) , TimeUnit . MILLISECONDS ) ; } else { results = srv . invokeAll ( callables ) ; } long duration = System . currentTimeMillis ( ) - time ; Boolean res ; try { res = results . get ( 0 ) . get ( ) ; } catch ( CancellationException | ExecutionException e ) { res = Boolean . FALSE ; e . printStackTrace ( listener . error ( e . getMessage ( ) ) ) ; } if ( ! res ) { System . out . println ( Messages . SSHLauncher_LaunchFailedDuration ( getTimestamp ( ) , nodeName , host , duration ) ) ; listener . getLogger ( ) . println ( getTimestamp ( ) + " Launch failed - cleaning up connection" ) ; cleanupConnection ( listener ) ; } else { System . out . println ( Messages . SSHLauncher_LaunchCompletedDuration ( getTimestamp ( ) , nodeName , host , duration ) ) ; } } catch ( InterruptedException e ) { System . out . println ( Messages . SSHLauncher_LaunchFailed ( getTimestamp ( ) , nodeName , host ) ) ; } finally { ExecutorService srv = launcherExecutorService ; if ( srv != null ) { srv . shutdownNow ( ) ; launcherExecutorService = null ; } } } if ( node != null && getTrackCredentials ( ) ) { CredentialsProvider . track ( node , getCredentials ( ) ) ; } |
public class XMLProperties { /** * Initializes the value of a property .
* @ todo move init code to the parser ?
* @ throws ClassNotFoundException if there is no class found for the given
* type
* @ throws IllegalArgumentException if the value given , is not parseable
* as the given type */
protected Object initPropertyValue ( String pValue , String pType , String pFormat ) throws ClassNotFoundException { } } | // System . out . println ( " pValue = " + pValue + " pType = " + pType
// + " pFormat = " + pFormat ) ;
// No value to convert
if ( pValue == null ) { return null ; } // No conversion needed for Strings
if ( ( pType == null ) || pType . equals ( "String" ) || pType . equals ( "java.lang.String" ) ) { return pValue ; } Object value ; if ( pType . equals ( "Date" ) || pType . equals ( "java.util.Date" ) ) { // Special parser needed
try { // Parse date through StringUtil
if ( pFormat == null ) { value = StringUtil . toDate ( pValue , sDefaultFormat ) ; } else { value = StringUtil . toDate ( pValue , new SimpleDateFormat ( pFormat ) ) ; } } catch ( IllegalArgumentException e ) { // Not parseable . . .
throw e ; } // Return
return value ; } else if ( pType . equals ( "java.sql.Timestamp" ) ) { // Special parser needed
try { // Parse timestamp through StringUtil
value = StringUtil . toTimestamp ( pValue ) ; } catch ( IllegalArgumentException e ) { // Not parseable . . .
throw new RuntimeException ( e . getMessage ( ) ) ; } // Return
return value ; } else { int dot = pType . indexOf ( "." ) ; if ( dot < 0 ) { pType = "java.lang." + pType ; } // Get class
Class cl = Class . forName ( pType ) ; // Try to create instance from < Constructor > ( String )
value = createInstance ( cl , pValue ) ; if ( value == null ) { // createInstance failed for some reason
// Try to invoke the static method valueof ( String )
value = invokeStaticMethod ( cl , "valueOf" , pValue ) ; // If the value is still null , well , then I cannot help . . .
} } // Return
return value ; |
public class CPDefinitionSpecificationOptionValueUtil { /** * Returns the last cp definition specification option value in the ordered set where CPSpecificationOptionId = & # 63 ; .
* @ param CPSpecificationOptionId the cp specification option ID
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the last matching cp definition specification option value , or < code > null < / code > if a matching cp definition specification option value could not be found */
public static CPDefinitionSpecificationOptionValue fetchByCPSpecificationOptionId_Last ( long CPSpecificationOptionId , OrderByComparator < CPDefinitionSpecificationOptionValue > orderByComparator ) { } } | return getPersistence ( ) . fetchByCPSpecificationOptionId_Last ( CPSpecificationOptionId , orderByComparator ) ; |
public class EntryListenerAdaptors { /** * Creates a { @ link com . hazelcast . map . impl . ListenerAdapter } array
* for all event types of { @ link com . hazelcast . core . EntryEventType } .
* @ param listener a { @ link EntryListener } instance .
* @ return an array of { @ link com . hazelcast . map . impl . ListenerAdapter } */
public static ListenerAdapter [ ] createListenerAdapters ( EntryListener listener ) { } } | // We only care about these reference event types for backward compatibility .
EntryEventType [ ] values = new EntryEventType [ ] { ADDED , REMOVED , EVICTED , UPDATED , EVICT_ALL , CLEAR_ALL } ; ListenerAdapter [ ] listenerAdapters = new ListenerAdapter [ values . length ] ; for ( EntryEventType eventType : values ) { listenerAdapters [ eventType . ordinal ( ) ] = createListenerAdapter ( eventType , listener ) ; } return listenerAdapters ; |
public class StringMapperBuilder { /** * Returns the { @ link StringMapper } represented by this { @ link MapperBuilder } .
* @ param field the name of the field to be built
* @ return the { @ link StringMapper } represented by this */
@ Override public StringMapper build ( String field ) { } } | return new StringMapper ( field , column , validated , caseSensitive ) ; |
public class GossipMonger { /** * Send message and optionally wait response
* @ param whisper
* @ return true if message is sended */
public boolean send ( Whisper < ? > whisper ) { } } | if ( isShutdown . get ( ) ) return false ; // Internal Queue ( Local Thread ) for INPLACE multiple recursive calls
final ArrayDeque < Whisper < ? > > localQueue = ref . get ( ) ; if ( ! localQueue . isEmpty ( ) ) { localQueue . addLast ( whisper ) ; return true ; } localQueue . addLast ( whisper ) ; while ( ( whisper = localQueue . peekFirst ( ) ) != null ) { final Integer type = whisper . dest ; final Set < Talker > set = map . get ( type ) ; if ( set != null ) { for ( final Talker talker : set ) { final TalkerContext ctx = talker . getState ( ) ; switch ( ctx . type ) { case INPLACE_UNSYNC : talker . newMessage ( whisper ) ; break ; case INPLACE_SYNC : synchronized ( talker ) { talker . newMessage ( whisper ) ; } break ; case QUEUED_UNBOUNDED : case QUEUED_BOUNDED : while ( ! ctx . queueMessage ( whisper ) ) ; break ; } } } localQueue . pollFirst ( ) ; } return true ; |
public class SearchCriteria { /** * Sets the specified projection to restrict the result values .
* < p > If the specified list is null or empty ,
* it clears the previous list .
* If one of the element in the list is null ,
* the previous list is not modified and an exception is thrown .
* @ param projections
* the projection list .
* @ throws IllegalArgumentException
* if an element in the specified list is null . */
public SearchCriteria setProjections ( final List < ? extends Projection > projections ) { } } | if ( projections == null || projections . size ( ) == 0 ) { clearProjections ( ) ; return this ; } synchronized ( projections ) { for ( Projection proj : projections ) { if ( proj == null ) { throw new IllegalArgumentException ( "null element" ) ; } } clearProjections ( ) ; for ( Projection proj : projections ) { addProjection ( proj ) ; } } return this ; |
public class AlpineQueryManager { /** * Creates a new Team with the specified name . If createApiKey is true ,
* then { @ link # createApiKey } is invoked and a cryptographically secure
* API key is generated .
* @ param name The name of th team
* @ param createApiKey whether or not to create an API key for the team
* @ return a Team
* @ since 1.0.0 */
public Team createTeam ( final String name , final boolean createApiKey ) { } } | pm . currentTransaction ( ) . begin ( ) ; final Team team = new Team ( ) ; team . setName ( name ) ; // todo assign permissions
pm . makePersistent ( team ) ; pm . currentTransaction ( ) . commit ( ) ; if ( createApiKey ) { createApiKey ( team ) ; } return getObjectByUuid ( Team . class , team . getUuid ( ) , Team . FetchGroup . ALL . name ( ) ) ; |
public class FilePersistedValueData { /** * { @ inheritDoc } */
public void readExternal ( ObjectInput in ) throws IOException , ClassNotFoundException { } } | orderNumber = in . readInt ( ) ; // read canonical file path
int size = in . readInt ( ) ; if ( size > 0 ) { byte [ ] buf = new byte [ size ] ; in . readFully ( buf ) ; File f = new File ( new String ( buf , "UTF-8" ) ) ; // validate if exists
if ( PrivilegedFileHelper . exists ( f ) ) { file = f ; } else { file = null ; } } else { // should not occurs but since we have a way to recover , it should not be
// an issue
file = null ; } |
public class AnnotationTypeDocImpl { /** * Returns the elements of this annotation type .
* Returns an empty array if there are none .
* Elements are always public , so no need to filter them . */
public AnnotationTypeElementDoc [ ] elements ( ) { } } | List < AnnotationTypeElementDoc > elements = List . nil ( ) ; for ( Symbol sym : tsym . members ( ) . getSymbols ( NON_RECURSIVE ) ) { if ( sym != null && sym . kind == MTH ) { MethodSymbol s = ( MethodSymbol ) sym ; elements = elements . prepend ( env . getAnnotationTypeElementDoc ( s ) ) ; } } return elements . toArray ( new AnnotationTypeElementDoc [ elements . length ( ) ] ) ; |
public class ConsumerMonitorRegistrar { /** * Method registerCallbackOnExistingExpression
* Adds a new callback to an existing entry to the appropriate wildcard
* or exact expression table .
* @ param topicExpression
* @ param isWildcarded
* @ param callback
* @ return */
public boolean registerCallbackOnExistingExpression ( ConnectionImpl connection , String topicExpression , boolean isWildcarded , ConsumerSetChangeCallback callback ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "registerCallbackOnExistingExpression" , new Object [ ] { connection , topicExpression , new Boolean ( isWildcarded ) , callback } ) ; boolean areConsumers = false ; RegisteredCallbacks rMonitor = null ; // Add the callback to the index of callbacks
addCallbackToConnectionIndex ( connection , topicExpression , isWildcarded , callback ) ; if ( isWildcarded ) rMonitor = ( RegisteredCallbacks ) _registeredWildcardConsumerMonitors . get ( topicExpression ) ; else rMonitor = ( RegisteredCallbacks ) _registeredExactConsumerMonitors . get ( topicExpression ) ; // Get the list of callbacks and add the new one
ArrayList callbackList = rMonitor . getWrappedCallbacks ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Found existing entry with callbacks: " + callbackList ) ; WrappedConsumerSetChangeCallback wcb = new WrappedConsumerSetChangeCallback ( callback ) ; // F011127
// When we call the registerconsumermonitor ( ) more than once with the same parameter ,
// there will be duplicate of callback in callbacklist . To overcome this leak we are checking before adding into the callbacklist
Iterator it = callbackList . iterator ( ) ; boolean alreadyExisting = false ; while ( it . hasNext ( ) ) { WrappedConsumerSetChangeCallback tmpwcb = ( WrappedConsumerSetChangeCallback ) it . next ( ) ; if ( tmpwcb . equals ( wcb ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "The same callback is already registerd for the topic expression :" + topicExpression + " Hence registration will not be done!" ) ; alreadyExisting = true ; break ; } } if ( ! alreadyExisting ) callbackList . add ( wcb ) ; // Get the list of matching consumers
ArrayList consumerList = rMonitor . getMatchingConsumers ( ) ; // Are there consumers for this expression
areConsumers = ! consumerList . isEmpty ( ) ; // Don ' t need to adjust the references in the consumer list as they will
// already have a reference to this topic expression
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "registerCallbackOnExistingExpression" , new Boolean ( areConsumers ) ) ; return areConsumers ; |
public class FileAuthenticationHandler { /** * Gets the password on record .
* @ param username the username
* @ return the password on record
* @ throws IOException Signals that an I / O exception has occurred . */
private String getPasswordOnRecord ( final String username ) throws IOException { } } | try ( val stream = Files . lines ( fileName . getFile ( ) . toPath ( ) ) ) { return stream . map ( line -> line . split ( this . separator ) ) . filter ( lineFields -> { val userOnRecord = lineFields [ 0 ] ; return username . equals ( userOnRecord ) ; } ) . map ( lineFields -> lineFields [ 1 ] ) . findFirst ( ) . orElse ( null ) ; } |
public class ReflectionUtil { /** * TODO : Add unit test */
public static Class < ? > getGenericTypeOfCollectionField ( Field field ) { } } | Type genericType = field . getGenericType ( ) ; if ( ! ( genericType instanceof ParameterizedType ) ) { throw new IllegalArgumentException ( "Field is not a ParameterizedType." ) ; } Type [ ] genericTypes = ( ( ParameterizedType ) genericType ) . getActualTypeArguments ( ) ; if ( genericTypes . length != 1 ) { throw new IllegalArgumentException ( "Field does not have a single generic type." ) ; } if ( ! ( genericTypes [ 0 ] instanceof Class ) ) { throw new IllegalArgumentException ( "Field's generic type is not a class?" ) ; } return ( Class < ? > ) genericTypes [ 0 ] ; |
public class BeanDefinitionParser { /** * Parse a property element .
* @ param ele a { @ link org . w3c . dom . Element } object .
* @ param bd a { @ link org . springframework . beans . factory . config . BeanDefinition } object . */
public void parsePropertyElement ( Element ele , BeanDefinition bd ) { } } | String propertyName = ele . getAttribute ( NAME_ATTRIBUTE ) ; if ( ! StringUtils . hasLength ( propertyName ) ) { error ( "Tag 'property' must have a 'name' attribute" , ele ) ; return ; } this . parseState . push ( new PropertyEntry ( propertyName ) ) ; try { if ( bd . getPropertyValues ( ) . contains ( propertyName ) ) { error ( "Multiple 'property' definitions for property '" + propertyName + "'" , ele ) ; return ; } Object val = parsePropertyValue ( ele , bd , propertyName ) ; PropertyValue pv = new PropertyValue ( propertyName , val ) ; parseMetaElements ( ele , pv ) ; pv . setSource ( extractSource ( ele ) ) ; bd . getPropertyValues ( ) . addPropertyValue ( pv ) ; } finally { this . parseState . pop ( ) ; } |
public class ApiOvhOrder { /** * Create order
* REST : POST / order / hosting / web / { serviceName } / cdn / { duration }
* @ param offer [ required ] Cdn offers you can add to your hosting
* @ param serviceName [ required ] The internal name of your hosting
* @ param duration [ required ] Duration */
public OvhOrder hosting_web_serviceName_cdn_duration_POST ( String serviceName , String duration , OvhCdnOfferEnum offer ) throws IOException { } } | String qPath = "/order/hosting/web/{serviceName}/cdn/{duration}" ; StringBuilder sb = path ( qPath , serviceName , duration ) ; HashMap < String , Object > o = new HashMap < String , Object > ( ) ; addBody ( o , "offer" , offer ) ; String resp = exec ( qPath , "POST" , sb . toString ( ) , o ) ; return convertTo ( resp , OvhOrder . class ) ; |
public class Main { /** * This function substitutes blank spaces in a provided string with a specified character .
* @ param originalString The original string that may contain blank spaces .
* @ param substitutionChar The character to replace blank spaces with .
* @ return The amended string with all blank spaces replaced by substitutionChar .
* Example :
* > > > substituteSpaces ( " hello people " , ' @ ' )
* " hello @ people "
* > > > substituteSpaces ( " python program language " , ' $ ' )
* " python $ program $ language "
* > > > substituteSpaces ( " blank space " , ' - ' )
* " blank - space " */
public static String substituteSpaces ( String originalString , char substitutionChar ) { } public static void main ( String [ ] args ) { System . out . println ( substituteSpaces ( "hello people" , '@' ) ) ; } } | String substitutedString = originalString . replace ( ' ' , substitutionChar ) ; return substitutedString ; |
public class ApplicationPermissionRepository { /** * region > findByRole ( programmatic ) */
@ Programmatic public List < ApplicationPermission > findByRoleCached ( final ApplicationRole role ) { } } | return queryResultsCache . execute ( new Callable < List < ApplicationPermission > > ( ) { @ Override public List < ApplicationPermission > call ( ) throws Exception { return findByRole ( role ) ; } } , ApplicationPermissionRepository . class , "findByRoleCached" , role ) ; |
public class Verifies { /** * RSA验证通知参数是否合法 ( 如APP服务器通知 )
* @ param notifyParams 通知参数
* @ return 合法返回true , 反之false */
public Boolean rsa ( Map < String , String > notifyParams ) { } } | String expectSign = notifyParams . get ( AlipayField . SIGN . field ( ) ) ; Map < String , String > validParams = filterSigningParams ( notifyParams ) ; String signing = buildSignString ( validParams ) ; checkNotNullAndEmpty ( alipay . appPubKey , "app public key can't be empty before rsa verify." ) ; return RSA . verify ( signing , expectSign , alipay . appPubKey , alipay . inputCharset ) ; |
public class Transfer { /** * Method declaration
* @ param ev */
public void actionPerformed ( ActionEvent ev ) { } } | if ( ev . getSource ( ) instanceof TextField ) { saveTable ( ) ; return ; } String s = ev . getActionCommand ( ) ; MenuItem i = new MenuItem ( ) ; if ( s == null ) { if ( ev . getSource ( ) instanceof MenuItem ) { i = ( MenuItem ) ev . getSource ( ) ; s = i . getLabel ( ) ; } } if ( s == null ) { } if ( s . equals ( "Start Transfer" ) || s . equals ( "ReStart Transfer" ) ) { bStart . setLabel ( "ReStart Transfer" ) ; bStart . invalidate ( ) ; CurrentTransfer = 0 ; CurrentAlter = 0 ; transfer ( ) ; } else if ( s . equals ( "Continue Transfer" ) ) { transfer ( ) ; } else if ( s . equals ( "Start Dump" ) || s . equals ( "Start Restore" ) ) { CurrentTransfer = 0 ; CurrentAlter = 0 ; transfer ( ) ; } else if ( s . equals ( "Quit" ) ) { exit ( ) ; } else if ( s . indexOf ( "Select Schema" ) >= 0 ) { String [ ] selection = lTable . getSelectedItems ( ) ; if ( ( selection == null ) || ( selection . length == 0 ) ) { return ; } if ( iSelectionStep == Transfer . SELECT_SOURCE_SCHEMA ) { sSourceSchemas = selection ; } else { sDestSchema = selection [ 0 ] ; } if ( iTransferMode == TRFM_DUMP ) { iSelectionStep = Transfer . SELECT_SOURCE_TABLES ; } else { iSelectionStep ++ ; } ProcessNextStep ( ) ; } else if ( s . indexOf ( "Select Catalog" ) >= 0 ) { String selection = lTable . getSelectedItem ( ) ; if ( ( selection == null ) || ( selection . equals ( "" ) ) ) { return ; } if ( iSelectionStep == Transfer . SELECT_SOURCE_CATALOG ) { sSourceCatalog = selection ; sSourceSchemas = null ; } else { sDestCatalog = selection ; sDestSchema = null ; try { targetDb . setCatalog ( sDestCatalog ) ; } catch ( Exception ex ) { trace ( "Catalog " + sDestCatalog + " could not be selected in the target database" ) ; sDestCatalog = null ; } } iSelectionStep ++ ; ProcessNextStep ( ) ; } else if ( s . equals ( "Insert 10 rows only" ) ) { iMaxRows = 10 ; } else if ( s . equals ( "Insert 1000 rows only" ) ) { iMaxRows = 1000 ; } else if ( s . equals ( "Insert all rows" ) ) { iMaxRows = 0 ; } else if ( s . equals ( "Load Settings..." ) ) { FileDialog f = new FileDialog ( fMain , "Load Settings" , FileDialog . LOAD ) ; f . show ( ) ; String file = f . getDirectory ( ) + f . getFile ( ) ; if ( file != null ) { LoadPrefs ( file ) ; displayTable ( tCurrent ) ; } } else if ( s . equals ( "Save Settings..." ) ) { FileDialog f = new FileDialog ( fMain , "Save Settings" , FileDialog . SAVE ) ; f . show ( ) ; String file = f . getDirectory ( ) + f . getFile ( ) ; if ( file != null ) { SavePrefs ( file ) ; } } else if ( s . equals ( "Exit" ) ) { windowClosing ( null ) ; } |
public class ScanResult { /** * Get classes that have a method with an annotation of the named type .
* @ param methodAnnotationName
* the name of the method annotation .
* @ return A list of classes with a method that has an annotation of the named type , or the empty list if none . */
public ClassInfoList getClassesWithMethodAnnotation ( final String methodAnnotationName ) { } } | if ( closed . get ( ) ) { throw new IllegalArgumentException ( "Cannot use a ScanResult after it has been closed" ) ; } if ( ! scanSpec . enableClassInfo || ! scanSpec . enableMethodInfo || ! scanSpec . enableAnnotationInfo ) { throw new IllegalArgumentException ( "Please call ClassGraph#enableClassInfo(), #enableMethodInfo(), " + "and #enableAnnotationInfo() before #scan()" ) ; } final ClassInfo classInfo = classNameToClassInfo . get ( methodAnnotationName ) ; return classInfo == null ? ClassInfoList . EMPTY_LIST : classInfo . getClassesWithMethodAnnotation ( ) ; |
public class FessMailDeliveryDepartmentCreator { protected SMailPostalPersonnel createPostalPersonnel ( ) { } } | final SMailDogmaticPostalPersonnel personnel = createDogmaticPostalPersonnel ( ) ; return fessConfig . isMailSendMock ( ) ? personnel . asTraining ( ) : personnel ; |
public class LogUtils { /** * Checks log level and logs
* @ param logger the Logger the log to
* @ param level the severity level
* @ param message the log message
* @ param parameters the parameters to substitute into message */
public static void log ( Logger logger , Level level , String message , Object [ ] parameters ) { } } | if ( logger . isLoggable ( level ) ) { String msg = localize ( logger , message ) ; try { msg = MessageFormat . format ( msg , parameters ) ; } catch ( IllegalArgumentException ex ) { // ignore , log as is
} doLog ( logger , level , msg , null ) ; } |
public class Quaternionf { /** * / * ( non - Javadoc )
* @ see org . joml . Quaternionfc # rotateAxis ( float , org . joml . Vector3fc , org . joml . Quaternionf ) */
public Quaternionf rotateAxis ( float angle , Vector3fc axis , Quaternionf dest ) { } } | return rotateAxis ( angle , axis . x ( ) , axis . y ( ) , axis . z ( ) , dest ) ; |
public class ALU { public static Object mult ( final Object o1 , final Object o2 ) { } } | switch ( getTypeMark ( o1 , o2 ) ) { case INTEGER : case SHORT : case BYTE : return ( ( Number ) o1 ) . intValue ( ) * ( ( Number ) o2 ) . intValue ( ) ; case LONG : return ( ( Number ) o1 ) . longValue ( ) * ( ( Number ) o2 ) . longValue ( ) ; case DOUBLE : return ( ( Number ) o1 ) . doubleValue ( ) * ( ( Number ) o2 ) . doubleValue ( ) ; case FLOAT : return ( ( Number ) o1 ) . floatValue ( ) * ( ( Number ) o2 ) . floatValue ( ) ; case BIG_INTEGER : if ( notDoubleOrFloat ( o1 , o2 ) ) { return toBigInteger ( o1 ) . multiply ( toBigInteger ( o2 ) ) ; } // Note : else upgrade to BigDecimal
case BIG_DECIMAL : return toBigDecimal ( o1 ) . multiply ( toBigDecimal ( o2 ) ) ; case CHAR : return mult ( charToInt ( o1 ) , charToInt ( o2 ) ) ; default : } throw unsupportedTypeException ( o1 , o2 ) ; |
public class SerializationFormatFactory { /** * Returns a list with all the defined serialization formats
* @ return a { @ link java . util . Collection } object . */
public static Collection < SerializationFormat > getAllFormats ( ) { } } | ArrayList < SerializationFormat > serializationFormats = new ArrayList < > ( ) ; // single graph formats
serializationFormats . add ( createTurtle ( ) ) ; serializationFormats . add ( createN3 ( ) ) ; serializationFormats . add ( createNTriples ( ) ) ; serializationFormats . add ( createJsonLD ( ) ) ; serializationFormats . add ( createRDFJson ( ) ) ; serializationFormats . add ( createRDFXMLAbbrevOut ( ) ) ; serializationFormats . add ( createRDFXMLIn ( ) ) ; serializationFormats . add ( createRDFXMLOut ( ) ) ; serializationFormats . add ( createRDFa ( ) ) ; serializationFormats . add ( createHTML ( ) ) ; serializationFormats . add ( createJunitXml ( ) ) ; // dataset formats
serializationFormats . add ( createNQads ( ) ) ; serializationFormats . add ( createTriG ( ) ) ; serializationFormats . add ( createTriX ( ) ) ; return serializationFormats ; |
public class BeanValidator { /** * { @ inheritDoc } */
@ Override public void restoreState ( final FacesContext context , final Object state ) { } } | if ( context == null ) { throw new NullPointerException ( "context" ) ; } if ( state != null ) { this . validationGroups = ( String ) state ; } else { // When the value is being validated , postSetValidationGroups ( ) sets
// validationGroups to javax . validation . groups . Default .
this . validationGroups = null ; } // Only the String is saved , recalculate the Class [ ] on state restoration .
// postSetValidationGroups ( ) ; |
public class BaseThrottle { /** * This method can only be called at the rate set by the { @ link # setRate } method , if it is called faster than this
* it will inject short pauses to restrict the call rate to that rate .
* @ throws InterruptedException If interrupted whilst performing a blocking wait on the throttle . */
public void throttle ( ) throws InterruptedException { } } | // Don ' t introduce any pause on the first call .
if ( ! firstCall ) { // Check if there is any time left in the cycle since the last throttle call to this method and introduce a
// short pause to fill that time if there is .
long remainingTimeNanos = timeToThrottleNanos ( ) ; while ( remainingTimeNanos > 0 ) { long milliPause = remainingTimeNanos / 1000000 ; int nanoPause = ( int ) ( remainingTimeNanos % 1000000 ) ; System . out . println ( "Waiting for " + milliPause + ":" + nanoPause ) ; Thread . sleep ( milliPause , nanoPause ) ; remainingTimeNanos = timeToThrottleNanos ( ) ; } } else { firstCall = false ; } |
public class CertificatesImpl { /** * Lists all of the certificates that have been added to the specified account .
* @ param certificateListOptions Additional parameters for the operation
* @ param serviceCallback the async ServiceCallback to handle successful and failed responses .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceFuture } object */
public ServiceFuture < List < Certificate > > listAsync ( final CertificateListOptions certificateListOptions , final ListOperationCallback < Certificate > serviceCallback ) { } } | return AzureServiceFuture . fromHeaderPageResponse ( listSinglePageAsync ( certificateListOptions ) , new Func1 < String , Observable < ServiceResponseWithHeaders < Page < Certificate > , CertificateListHeaders > > > ( ) { @ Override public Observable < ServiceResponseWithHeaders < Page < Certificate > , CertificateListHeaders > > call ( String nextPageLink ) { CertificateListNextOptions certificateListNextOptions = null ; if ( certificateListOptions != null ) { certificateListNextOptions = new CertificateListNextOptions ( ) ; certificateListNextOptions . withClientRequestId ( certificateListOptions . clientRequestId ( ) ) ; certificateListNextOptions . withReturnClientRequestId ( certificateListOptions . returnClientRequestId ( ) ) ; certificateListNextOptions . withOcpDate ( certificateListOptions . ocpDate ( ) ) ; } return listNextSinglePageAsync ( nextPageLink , certificateListNextOptions ) ; } } , serviceCallback ) ; |
public class BufferedCollectionValueModel { public static Class getConcreteCollectionType ( Class wrappedType ) { } } | Class class2Create ; if ( wrappedType . isArray ( ) ) { if ( ClassUtils . isPrimitiveArray ( wrappedType ) ) { throw new IllegalArgumentException ( "wrappedType can not be an array of primitive types" ) ; } class2Create = wrappedType ; } else if ( wrappedType == Collection . class ) { class2Create = ArrayList . class ; } else if ( wrappedType == List . class ) { class2Create = ArrayList . class ; } else if ( wrappedType == Set . class ) { class2Create = HashSet . class ; } else if ( wrappedType == SortedSet . class ) { class2Create = TreeSet . class ; } else if ( Collection . class . isAssignableFrom ( wrappedType ) ) { if ( wrappedType . isInterface ( ) ) { throw new IllegalArgumentException ( "unable to handle Collection of type [" + wrappedType + "]. Do not know how to create a concrete implementation" ) ; } class2Create = wrappedType ; } else { throw new IllegalArgumentException ( "wrappedType [" + wrappedType + "] must be an array or a Collection" ) ; } return class2Create ; |
public class EnableAWSServiceAccessRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( EnableAWSServiceAccessRequest enableAWSServiceAccessRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( enableAWSServiceAccessRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( enableAWSServiceAccessRequest . getServicePrincipal ( ) , SERVICEPRINCIPAL_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class MirrorTable { /** * Add this record ( Always called from the record class ) .
* @ exception DBException File exception . */
public void add ( Rec fieldList ) throws DBException { } } | Record record = ( Record ) fieldList ; boolean bRefreshed = true ; if ( ( this . getRecord ( ) . getOpenMode ( ) & DBConstants . OPEN_REFRESH_AND_LOCK_ON_CHANGE_STRATEGY ) == DBConstants . OPEN_REFRESH_AND_LOCK_ON_CHANGE_STRATEGY ) bRefreshed = record . isRefreshedRecord ( ) ; // Only do this on the second write
super . add ( record ) ; if ( bRefreshed ) { // On second only
Iterator < BaseTable > iterator = this . getTables ( ) ; while ( iterator . hasNext ( ) ) { BaseTable table = iterator . next ( ) ; if ( ( table != null ) && ( table != this . getNextTable ( ) ) ) { if ( table . getRecord ( ) . getEditMode ( ) == Constants . EDIT_ADD ) { // Should have been in sync , but it is now !
Record record2 = table . getRecord ( ) ; boolean bIsAutoSequence = record2 . setAutoSequence ( false ) ; this . copyRecord ( record2 , record ) ; try { table . add ( record2 ) ; } catch ( DBException ex ) { throw ex ; } finally { record2 . setAutoSequence ( bIsAutoSequence ) ; } } } } } |
public class Classification { /** * Check if the root classification of this classification is assigned to
* the given company .
* @ see # companies
* @ param _ company copmany that will be checked for assignment
* @ return true it the root classification of this classification is
* assigned to the given company , else
* @ throws CacheReloadException on error */
public boolean isAssigendTo ( final Company _company ) throws CacheReloadException { } } | final boolean ret ; if ( isRoot ( ) ) { ret = this . companies . isEmpty ( ) ? true : this . companies . contains ( _company ) ; } else { ret = getParentClassification ( ) . isAssigendTo ( _company ) ; } return ret ; |
public class PageOnePromotedBiddingScheme { /** * Sets the bidCeiling value for this PageOnePromotedBiddingScheme .
* @ param bidCeiling * Strategy maximum bid limit in advertiser local currency micro
* units .
* This upper limit applies to all keywords managed
* by the strategy .
* < span class = " constraint InRange " > This field must
* be greater than or equal to 0 . < / span > */
public void setBidCeiling ( com . google . api . ads . adwords . axis . v201809 . cm . Money bidCeiling ) { } } | this . bidCeiling = bidCeiling ; |
public class CpoException { /** * Prints the composite message and the embedded stack trace to the specified print writer
* < code > pw < / code > .
* @ param pw the print writer */
@ Override public void printStackTrace ( java . io . PrintWriter pw ) { } } | synchronized ( pw ) { if ( detail != null ) { detail . printStackTrace ( pw ) ; } super . printStackTrace ( pw ) ; } |
public class SerializerIntrinsics { /** * ! preserved . */
public final void fild ( Mem src ) { } } | assert ( src . size ( ) == 2 || src . size ( ) == 4 || src . size ( ) == 8 ) ; emitX86 ( INST_FILD , src ) ; |
public class GroovyMain { /** * TODO : should we have an ' err ' printstream too for ParseException ? */
static void processArgs ( String [ ] args , final PrintStream out ) { } } | Options options = buildOptions ( ) ; try { CommandLine cmd = parseCommandLine ( options , args ) ; if ( cmd . hasOption ( 'h' ) ) { printHelp ( out , options ) ; } else if ( cmd . hasOption ( 'v' ) ) { String version = GroovySystem . getVersion ( ) ; out . println ( "Groovy Version: " + version + " JVM: " + System . getProperty ( "java.version" ) + " Vendor: " + System . getProperty ( "java.vm.vendor" ) + " OS: " + System . getProperty ( "os.name" ) ) ; } else { // If we fail , then exit with an error so scripting frameworks can catch it
// TODO : pass printstream ( s ) down through process
if ( ! process ( cmd ) ) { System . exit ( 1 ) ; } } } catch ( ParseException pe ) { out . println ( "error: " + pe . getMessage ( ) ) ; printHelp ( out , options ) ; } catch ( IOException ioe ) { out . println ( "error: " + ioe . getMessage ( ) ) ; } |
public class AppEngineDatastoreSession { /** * Closes this session . */
@ Override public void close ( ) { } } | AppEngineTransaction tx = transaction . get ( ) ; if ( tx != null ) { tx . rollback ( ) ; } |
public class ModularParser { /** * Deleting all comments out of the SpanManager . . . < br >
* & lt ! - - COMMENT - - > */
private void deleteComments ( SpanManager sm ) { } } | int start = 0 ; while ( ( start = sm . indexOf ( "<!--" , start ) ) != - 1 ) { int end = sm . indexOf ( "-->" , start + 4 ) + 3 ; if ( end == - 1 + 3 ) { end = sm . length ( ) ; } // Remove the one lineSeparator too , if the whole line is a comment !
try { if ( lineSeparator . equals ( sm . substring ( start - lineSeparator . length ( ) , start ) ) && lineSeparator . equals ( sm . substring ( end , end + lineSeparator . length ( ) ) ) ) { end += lineSeparator . length ( ) ; } } catch ( IndexOutOfBoundsException e ) { } sm . delete ( start , end ) ; } |
public class StreamMonitorRouter { /** * Notify the monitor of the an error during the download
* process .
* @ param resource the name of the remote resource .
* @ param message a non - localized message describing the problem in english . */
public void notifyError ( URL resource , String message ) { } } | synchronized ( m_Monitors ) { for ( StreamMonitor monitor : m_Monitors ) { monitor . notifyError ( resource , message ) ; } } |
public class TvShowsActivity { /** * Hook DraggableListener to draggableView to modify action bar title with the tv show
* information . */
private void hookListeners ( ) { } } | draggableView . setDraggableListener ( new DraggableListener ( ) { @ Override public void onMaximized ( ) { updateActionBarTitle ( ) ; } @ Override public void onMinimized ( ) { updateActionBarTitle ( ) ; } @ Override public void onClosedToLeft ( ) { resetActionBarTitle ( ) ; } @ Override public void onClosedToRight ( ) { resetActionBarTitle ( ) ; } } ) ; |
public class RaftSessionManager { /** * Resets the session manager ' s cluster information .
* @ param leader The leader address .
* @ param servers The collection of servers . */
public void resetConnections ( MemberId leader , Collection < MemberId > servers ) { } } | selectorManager . resetAll ( leader , servers ) ; |
public class InstanceSnapshotInfo { /** * A list of objects describing the disks that were attached to the source instance .
* @ param fromDiskInfo
* A list of objects describing the disks that were attached to the source instance . */
public void setFromDiskInfo ( java . util . Collection < DiskInfo > fromDiskInfo ) { } } | if ( fromDiskInfo == null ) { this . fromDiskInfo = null ; return ; } this . fromDiskInfo = new java . util . ArrayList < DiskInfo > ( fromDiskInfo ) ; |
public class Coercions { /** * Coerces a value to an Integer , returning null if the coercion
* isn ' t possible . */
public static Integer coerceToInteger ( Object pValue , Logger pLogger ) throws ELException { } } | if ( pValue == null ) { return null ; } else if ( pValue instanceof Character ) { return PrimitiveObjects . getInteger ( ( int ) ( ( ( Character ) pValue ) . charValue ( ) ) ) ; } else if ( pValue instanceof Boolean ) { if ( pLogger . isLoggingWarning ( ) ) { pLogger . logWarning ( Constants . BOOLEAN_TO_NUMBER , pValue , Integer . class . getName ( ) ) ; } return PrimitiveObjects . getInteger ( ( ( Boolean ) pValue ) . booleanValue ( ) ? 1 : 0 ) ; } else if ( pValue instanceof Integer ) { return ( Integer ) pValue ; } else if ( pValue instanceof Number ) { return PrimitiveObjects . getInteger ( ( ( Number ) pValue ) . intValue ( ) ) ; } else if ( pValue instanceof String ) { try { return Integer . valueOf ( ( String ) pValue ) ; } catch ( Exception exc ) { if ( pLogger . isLoggingWarning ( ) ) { pLogger . logWarning ( Constants . STRING_TO_NUMBER_EXCEPTION , ( String ) pValue , Integer . class . getName ( ) ) ; } return null ; } } else { if ( pLogger . isLoggingWarning ( ) ) { pLogger . logWarning ( Constants . COERCE_TO_NUMBER , pValue . getClass ( ) . getName ( ) , Integer . class . getName ( ) ) ; } return null ; } |
public class Taint { /** * Adds location for a taint source or path to remember for reporting
* @ param location location to remember
* @ param isKnownTaintSource true for tainted value , false if just not safe
* @ throws NullPointerException if location is null */
public void addLocation ( TaintLocation location , boolean isKnownTaintSource ) { } } | Objects . requireNonNull ( location , "location is null" ) ; if ( isKnownTaintSource ) { taintLocations . add ( location ) ; } else { unknownLocations . add ( location ) ; } |
public class StructureIO { /** * Loads a structure based on a name . Supported naming conventions are :
* < pre >
* Formal specification for how to specify the < i > name < / i > :
* name : = pdbID
* | pdbID ' . ' chainID
* | pdbID ' . ' range
* | scopID
* | biol
* | pdp
* range : = ' ( ' ? range ( ' , ' range ) ? ' ) ' ?
* | chainID
* | chainID ' _ ' resNum ' - ' resNum
* pdbID : = [ 0-9 ] [ a - zA - Z0-9 ] { 3}
* chainID : = [ a - zA - Z0-9]
* scopID : = ' d ' pdbID [ a - z _ ] [ 0-9 _ ]
* biol : = ' BIO : ' pdbID [ : ] ? [ 0-9 ] +
* pdp : = ' PDP : ' pdbID [ A - Za - z0-9 _ ] +
* resNum : = [ - + ] ? [ 0-9 ] + [ A - Za - z ] ?
* Example structures :
* 1TIM # whole structure - asym unit
* 4HHB . C # single chain
* 4GCR . A _ 1-83 # one domain , by residue number
* 3AA0 . A , B # two chains treated as one structure
* d2bq6a1 # scop domain
* BIO : 1fah # biological assembly nr 1 for 1fah
* BIO : 1fah : 0 # asym unit for 1fah
* BIO : 1fah : 1 # biological assembly nr 1 for 1fah
* BIO : 1fah : 2 # biological assembly nr 2 for 1fah
* < / pre >
* With the additional set of rules :
* < ul >
* < li > If only a PDB code is provided , the whole structure will be return including ligands , but the first model only ( for NMR ) .
* < li > Chain IDs are case sensitive , PDB ids are not . To specify a particular chain write as : 4hhb . A or 4HHB . A < / li >
* < li > To specify a SCOP domain write a scopId e . g . d2bq6a1 . Some flexibility can be allowed in SCOP domain names , see { @ link # setStrictSCOP ( boolean ) } < / li >
* < li > URLs are accepted as well < / li >
* < / ul >
* @ param name
* @ return a Structure object , or null if name appears improperly formated ( eg too short , etc )
* @ throws IOException The PDB file cannot be cached due to IO errors
* @ throws StructureException The name appeared valid but did not correspond to a structure .
* Also thrown by some submethods upon errors , eg for poorly formatted subranges . */
public static Structure getStructure ( String name ) throws IOException , StructureException { } } | checkInitAtomCache ( ) ; // delegate this functionality to AtomCache . . .
return cache . getStructure ( name ) ; |
public class TrieNodeFactoryForBooleanKey { /** * specialized in speed for boolean keyed nodes . */
public static TrieNodeFactory < Boolean > getInstance ( ) { } } | return new TrieNodeFactory < Boolean > ( ) { @ Override public TrieNode < Boolean > create ( ) { return new BooleanTrieNode ( ) ; } } ; |
public class ResettableOAuth2AuthorizedClientService { /** * Copy of { @ link InMemoryOAuth2AuthorizedClientService # loadAuthorizedClient ( String , String ) } */
@ SuppressWarnings ( "unchecked" ) @ Override public < T extends OAuth2AuthorizedClient > T loadAuthorizedClient ( String clientRegistrationId , String principalName ) { } } | Assert . hasText ( clientRegistrationId , "clientRegistrationId cannot be empty" ) ; Assert . hasText ( principalName , "principalName cannot be empty" ) ; ClientRegistration registration = this . clientRegistrationRepository . findByRegistrationId ( clientRegistrationId ) ; if ( registration == null ) { return null ; } return ( T ) this . authorizedClients . get ( this . getIdentifier ( registration , principalName ) ) ; |
public class AopAllianceSimulatorImpl { /** * { @ inheritDoc } */
public void setRootPath ( Class < ? extends Object > testClass ) { } } | String resource = new StringBuilder ( ) . append ( testClass . getSimpleName ( ) ) . append ( ".class" ) . toString ( ) ; try { setRootPath ( new File ( testClass . getResource ( resource ) . toURI ( ) ) . getParentFile ( ) . toPath ( ) . toString ( ) ) ; } catch ( URISyntaxException e ) { throw new RuntimeException ( e ) ; } |
public class ClassBuilderSimple { public static byte [ ] build ( String className , String superName ) { } } | ByteBuffer bb = ByteBuffer . allocate ( 1000 ) ; bb . put ( BA0_1 ) ; // bb . put ( BA2 ) ;
writeUtf8 ( bb , convertDots ( className ) ) ; bb . put ( BA3 ) ; // bb . put ( BA4 ) ;
writeUtf8 ( bb , convertDots ( superName ) ) ; bb . put ( BA5_12 ) ; // bb . put ( BA13 ) ;
writeUtf8 ( bb , "L" + convertDots ( className ) + ";" ) ; bb . put ( BA14 ) ; // bb . put ( BA15 ) ;
String fName = convertDots ( className ) ; fName = fName . substring ( fName . lastIndexOf ( '/' ) + 1 ) ; fName += ".java" ; writeUtf8 ( bb , fName ) ; bb . put ( BA_end ) ; byte [ ] ba = new byte [ bb . position ( ) ] ; bb . rewind ( ) ; bb . get ( ba ) ; return ba ; |
public class DefaultHistoryManager { /** * ( non - Javadoc )
* @ see org . activiti . engine . impl . history . HistoryManagerInterface # recordTaskDescriptionChange ( java . lang . String , java . lang . String ) */
@ Override public void recordTaskDescriptionChange ( String taskId , String description ) { } } | if ( isHistoryLevelAtLeast ( HistoryLevel . AUDIT ) ) { HistoricTaskInstanceEntity historicTaskInstance = getHistoricTaskInstanceEntityManager ( ) . findById ( taskId ) ; if ( historicTaskInstance != null ) { historicTaskInstance . setDescription ( description ) ; } } |
public class DestinationManager { /** * Before reconciliation , we need to move any inDoubt handlers
* to the Unreconciled state .
* If the destination gets reconciled then we have recovered .
* If not , we might get moved back to the inDoubt state , arguing
* that the corrupt WCCM file is stil causing problems ,
* or finally WCCM might now tell us to remove the destination
* @ author tpm */
public void moveAllInDoubtToUnreconciled ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "moveAllInDoubtToUnreconciled" ) ; DestinationTypeFilter filter = new DestinationTypeFilter ( ) ; filter . LOCAL = Boolean . TRUE ; filter . INDOUBT = Boolean . TRUE ; SIMPIterator itr = destinationIndex . iterator ( filter ) ; while ( itr . hasNext ( ) ) { BaseDestinationHandler destHand = ( BaseDestinationHandler ) itr . next ( ) ; destinationIndex . putUnreconciled ( destHand ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "moveAllInDoubtToUnreconciled" ) ; |
public class BatchedTimeoutManager { /** * Restart alarms for a a list of BTEs
* @ param timedout the list of BTEs to be restarted */
private void restartEntries ( List timedout ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "restartEntries" , new Object [ ] { timedout } ) ; // iterate over the list of entries
Iterator itr = timedout . iterator ( ) ; while ( itr . hasNext ( ) ) { BatchedTimeoutEntry bte = ( BatchedTimeoutEntry ) itr . next ( ) ; // get the BTE ' s entry in the active list
LinkedListEntry entry = bte . getEntry ( ) ; // if it is not in the list ( i . e . the entry is null ) then it has already been removed
if ( entry != null && activeEntries . contains ( entry ) ) { // start a new alarms
startNewAlarm ( entry ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "restartEntries" ) ; |
public class DistributedExceptionInfo { /** * Get the original exception in a possible chain of exceptions .
* If no previous exceptions have been chained , null will be returned .
* @ exception com . ibm . websphere . exception . ExceptionInstantiationException
* An exception occurred while trying to instantiate an exception object .
* If this exception is thrown , the relevant information can be retrieved
* by using the getPreviousExceptionInfo ( ) method .
* @ return java . lang . Throwable The first exception in a chain of
* exceptions . If no exceptions have been chained , null will be returned . */
public Throwable getOriginalException ( ) throws ExceptionInstantiationException { } } | Throwable prevEx = null ; if ( previousExceptionInfo != null ) { prevEx = previousExceptionInfo . getOriginalException ( ) ; if ( prevEx == null ) { prevEx = getPreviousException ( ) ; } } return prevEx ; |
public class IndexBuilder { /** * because its only reference is in native code , then we will get a crash . */
private static IndexEnvironment setupIndexer ( File outputDirectory , int memory , boolean storeDocs ) throws Exception { } } | final IndexEnvironment env = new IndexEnvironment ( ) ; env . setMemory ( memory * ONE_MEGABYTE ) ; final Specification spec = env . getFileClassSpec ( "trectext" ) ; env . addFileClass ( spec ) ; env . setStoreDocs ( storeDocs ) ; // if we don ' t build indices on DOCNO then getting the docIds at query time is
// extremely slow
env . setMetadataIndexedFields ( new String [ ] { "docno" } , new String [ ] { "docno" } ) ; env . create ( outputDirectory . getAbsolutePath ( ) , statusMonitor ) ; return env ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.