signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class InstanceSnapshotInfoMarshaller { /** * Marshall the given parameter object . */
public void marshall ( InstanceSnapshotInfo instanceSnapshotInfo , ProtocolMarshaller protocolMarshaller ) { } } | if ( instanceSnapshotInfo == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( instanceSnapshotInfo . getFromBundleId ( ) , FROMBUNDLEID_BINDING ) ; protocolMarshaller . marshall ( instanceSnapshotInfo . getFromBlueprintId ( ) , FROMBLUEPRINTID_BINDING ) ; protocolMarshaller . marshall ( instanceSnapshotInfo . getFromDiskInfo ( ) , FROMDISKINFO_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class MatrixFeatures_D { /** * Checks to see if each element in the two matrices are equal :
* a < sub > ij < / sub > = = b < sub > ij < / sub >
* NOTE : If any of the elements are NaN then false is returned . If two corresponding
* elements are both positive or negative infinity then they are equal .
* @ param a A matrix . Not modified .
* @ param b A matrix . Not modified .
* @ return true if identical and false otherwise . */
public static boolean isEquals ( DMatrix a , DMatrix b ) { } } | if ( a . getNumRows ( ) != b . getNumRows ( ) || a . getNumCols ( ) != b . getNumCols ( ) ) return false ; final int numRows = a . getNumRows ( ) ; final int numCols = a . getNumCols ( ) ; for ( int row = 0 ; row < numRows ; row ++ ) { for ( int col = 0 ; col < numCols ; col ++ ) { if ( ! ( a . unsafe_get ( row , col ) == b . unsafe_get ( row , col ) ) ) return false ; } } return true ; |
public class DatabaseDAODefaultImpl { public DbAttribute [ ] get_device_attribute_property ( Database database , String deviceName , String [ ] attnames ) throws DevFailed { } } | if ( ! database . isAccess_checked ( ) ) checkAccess ( database ) ; DeviceData argIn = new DeviceData ( ) ; DeviceData argOut ; int mode = 2 ; try { // value is an array
argIn . insert ( ApiUtil . toStringArray ( deviceName , attnames ) ) ; argOut = command_inout ( database , "DbGetDeviceAttributeProperty2" , argIn ) ; } catch ( DevFailed e ) { if ( e . errors [ 0 ] . reason . equals ( "API_CommandNotFound" ) ) { // Value is just one element
argOut = command_inout ( database , "DbGetDeviceAttributeProperty" , argIn ) ; mode = 1 ; } else throw e ; } return ApiUtil . toDbAttributeArray ( argOut . extractStringArray ( ) , mode ) ; |
public class CmsUserDriver { /** * Writes a new additional user info . < p >
* @ param dbc the current dbc
* @ param userId the user id to add the user info for
* @ param key the name of the additional user info
* @ param value the value of the additional user info
* @ throws CmsDataAccessException if something goes wrong */
@ Override protected void internalWriteUserInfo ( CmsDbContext dbc , CmsUUID userId , String key , Object value ) throws CmsDataAccessException { } } | PreparedStatement stmt = null ; Connection conn = null ; try { // get connection
conn = m_sqlManager . getConnection ( dbc ) ; // write data to database
stmt = m_sqlManager . getPreparedStatement ( conn , "C_ORACLE_USERDATA_WRITE_3" ) ; stmt . setString ( 1 , userId . toString ( ) ) ; stmt . setString ( 2 , key ) ; stmt . setString ( 3 , value . getClass ( ) . getName ( ) ) ; stmt . executeUpdate ( ) ; } catch ( SQLException e ) { throw new CmsDbSqlException ( org . opencms . db . generic . Messages . get ( ) . container ( org . opencms . db . generic . Messages . ERR_GENERIC_SQL_1 , CmsDbSqlException . getErrorQuery ( stmt ) ) , e ) ; } finally { m_sqlManager . closeAll ( dbc , conn , stmt , null ) ; } internalUpdateUserInfoData ( dbc , userId , key , value ) ; |
public class Store { /** * Method to initialize the Cache of this CacheObjectInterface .
* @ throws CacheReloadException on error during loading of cache */
public static void initialize ( ) throws CacheReloadException { } } | if ( InfinispanCache . get ( ) . exists ( Store . UUIDCACHE ) ) { InfinispanCache . get ( ) . < UUID , Store > getCache ( Store . UUIDCACHE ) . clear ( ) ; } else { InfinispanCache . get ( ) . < UUID , Store > getCache ( Store . UUIDCACHE ) . addListener ( new CacheLogListener ( Store . LOG ) ) ; } if ( InfinispanCache . get ( ) . exists ( Store . IDCACHE ) ) { InfinispanCache . get ( ) . < Long , Store > getCache ( Store . IDCACHE ) . clear ( ) ; } else { InfinispanCache . get ( ) . < Long , Store > getCache ( Store . IDCACHE ) . addListener ( new CacheLogListener ( Store . LOG ) ) ; } if ( InfinispanCache . get ( ) . exists ( Store . NAMECACHE ) ) { InfinispanCache . get ( ) . < String , Store > getCache ( Store . NAMECACHE ) . clear ( ) ; } else { InfinispanCache . get ( ) . < String , Store > getCache ( Store . NAMECACHE ) . addListener ( new CacheLogListener ( Store . LOG ) ) ; } |
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EClass getIfcMedicalDeviceType ( ) { } } | if ( ifcMedicalDeviceTypeEClass == null ) { ifcMedicalDeviceTypeEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 379 ) ; } return ifcMedicalDeviceTypeEClass ; |
public class CrashReportDialog { /** * ( non - Javadoc )
* @ see android . app . Activity # onSaveInstanceState ( android . os . Bundle ) */
@ CallSuper @ Override protected void onSaveInstanceState ( @ NonNull Bundle outState ) { } } | super . onSaveInstanceState ( outState ) ; if ( userCommentView != null && userCommentView . getText ( ) != null ) { outState . putString ( STATE_COMMENT , userCommentView . getText ( ) . toString ( ) ) ; } if ( userEmailView != null && userEmailView . getText ( ) != null ) { outState . putString ( STATE_EMAIL , userEmailView . getText ( ) . toString ( ) ) ; } |
public class GeometryConverter { /** * Takes in a GWT geometry , and creates a new DTO geometry from it .
* @ param geometry
* The geometry to convert into a DTO geometry .
* @ return Returns a DTO type geometry , that is serializable . */
public static Geometry toDto ( org . geomajas . gwt . client . spatial . geometry . Geometry geometry ) { } } | if ( geometry == null ) { return null ; } int srid = geometry . getSrid ( ) ; int precision = geometry . getPrecision ( ) ; Geometry dto ; if ( geometry instanceof Point ) { dto = new Geometry ( Geometry . POINT , srid , precision ) ; dto . setCoordinates ( geometry . getCoordinates ( ) ) ; } else if ( geometry instanceof LinearRing ) { dto = new Geometry ( Geometry . LINEAR_RING , srid , precision ) ; dto . setCoordinates ( geometry . getCoordinates ( ) ) ; } else if ( geometry instanceof LineString ) { dto = new Geometry ( Geometry . LINE_STRING , srid , precision ) ; dto . setCoordinates ( geometry . getCoordinates ( ) ) ; } else if ( geometry instanceof Polygon ) { dto = new Geometry ( Geometry . POLYGON , srid , precision ) ; Polygon polygon = ( Polygon ) geometry ; if ( ! polygon . isEmpty ( ) ) { Geometry [ ] geometries = new Geometry [ polygon . getNumInteriorRing ( ) + 1 ] ; for ( int i = 0 ; i < geometries . length ; i ++ ) { if ( i == 0 ) { geometries [ i ] = toDto ( polygon . getExteriorRing ( ) ) ; } else { geometries [ i ] = toDto ( polygon . getInteriorRingN ( i - 1 ) ) ; } } dto . setGeometries ( geometries ) ; } } else if ( geometry instanceof MultiPoint ) { dto = new Geometry ( Geometry . MULTI_POINT , srid , precision ) ; dto . setGeometries ( convertGeometries ( geometry ) ) ; } else if ( geometry instanceof MultiLineString ) { dto = new Geometry ( Geometry . MULTI_LINE_STRING , srid , precision ) ; dto . setGeometries ( convertGeometries ( geometry ) ) ; } else if ( geometry instanceof MultiPolygon ) { dto = new Geometry ( Geometry . MULTI_POLYGON , srid , precision ) ; dto . setGeometries ( convertGeometries ( geometry ) ) ; } else { String msg = "GeometryConverter.toDto() unrecognized geometry type" ; Log . logServer ( Log . LEVEL_ERROR , msg ) ; throw new IllegalStateException ( msg ) ; } return dto ; |
public class JDBC4Connection { /** * Creates a PreparedStatement object that will generate ResultSet objects with the given type , concurrency , and holdability . */
@ Override public PreparedStatement prepareStatement ( String sql , int resultSetType , int resultSetConcurrency , int resultSetHoldability ) throws SQLException { } } | checkClosed ( ) ; throw SQLError . noSupport ( ) ; |
public class CatalogueClient { /** * Description methods */
public CatalogueDescription discover ( String uri , Parameter ... parameters ) { } } | return invoke ( descriptionDigesterLoader , uri , parameters ) ; |
public class Widgets { /** * Create and return a widget using the given factory and the given options . */
protected < W extends Widget > W widget ( WidgetFactory < W > factory , WidgetInitializer < W > initializers ) { } } | return widget ( get ( 0 ) , factory , initializers ) ; |
public class GridLayout { /** * This is a shortcut method that will create a grid layout data object that will expand its cell as much as is can
* vertically and make the component occupy the whole area vertically and center it horizontally
* @ param horizontalSpan How many cells to span vertically
* @ return Layout data object with the specified span and vertically expanding as much as it can */
public static LayoutData createHorizontallyEndAlignedLayoutData ( int horizontalSpan ) { } } | return createLayoutData ( Alignment . END , Alignment . CENTER , true , false , horizontalSpan , 1 ) ; |
public class JKObjectUtil { public static void callMethod ( final Object obj , final String methodName , final Object ... args ) { } } | try { callMethod ( obj , methodName , false , args ) ; } catch ( InvocationTargetException e ) { JK . throww ( e ) ; } |
public class MetadataFinder { /** * Ask the specified player for metadata about the track in the specified slot with the specified rekordbox ID ,
* unless we have a metadata cache available for the specified media slot , in which case that will be used instead .
* @ param track uniquely identifies the track whose metadata is desired
* @ param trackType identifies the type of track being requested , which affects the type of metadata request
* message that must be used
* @ return the metadata , if any */
@ SuppressWarnings ( "WeakerAccess" ) public TrackMetadata requestMetadataFrom ( final DataReference track , final CdjStatus . TrackType trackType ) { } } | return requestMetadataInternal ( track , trackType , false ) ; |
public class Server { /** * Register global scope
* @ param scope
* Global scope to register */
public void registerGlobal ( IGlobalScope scope ) { } } | log . trace ( "Registering global scope: {}" , scope . getName ( ) , scope ) ; globals . put ( scope . getName ( ) , scope ) ; |
public class LexiconUtility { /** * 从HanLP的词库中提取某个单词的属性 ( 包括核心词典和用户词典 )
* @ param word 单词
* @ return 包含词性与频次的信息 */
public static CoreDictionary . Attribute getAttribute ( String word ) { } } | CoreDictionary . Attribute attribute = CoreDictionary . get ( word ) ; if ( attribute != null ) return attribute ; return CustomDictionary . get ( word ) ; |
public class InitReactorRunner { /** * Like { @ link Task # getDisplayName } but more robust . */
@ Restricted ( NoExternalUse . class ) public static String getDisplayName ( Task t ) { } } | try { return t . getDisplayName ( ) ; } catch ( RuntimeException | Error x ) { LOGGER . log ( Level . WARNING , "failed to find displayName of " + t , x ) ; return t . toString ( ) ; } |
public class GeneratePreferencesFile { /** * The real method that does the job .
* @ param args
* @ throws Exception */
public void run ( String [ ] args ) throws Exception { } } | // Check the argument
if ( args . length != 1 ) throw new RuntimeException ( "A file path was expected as an argument." ) ; File targetFile = new File ( args [ 0 ] ) ; if ( ! targetFile . isFile ( ) ) throw new RuntimeException ( "File " + targetFile + " does not exist." ) ; // Prepare the comments for all the properties
Field [ ] fields = IPreferencesMngr . class . getDeclaredFields ( ) ; Map < String , String > propertyNameToComment = new HashMap < > ( ) ; for ( Field field : fields ) { String constantName = ( String ) field . get ( null ) ; PreferenceDescription annotation = field . getAnnotation ( PreferenceDescription . class ) ; if ( annotation == null ) throw new RuntimeException ( "Documentation was not written for the " + field . getName ( ) + " constant in IPreferencesMngr.java." ) ; StringBuilder sb = new StringBuilder ( ) ; sb . append ( annotation . desc ( ) ) ; String [ ] values = annotation . values ( ) ; if ( values . length > 0 ) { sb . append ( "\n\nPossible values:\n" ) ; for ( String value : values ) { sb . append ( " - " ) ; sb . append ( value ) ; sb . append ( "\n" ) ; } } propertyNameToComment . put ( constantName , sb . toString ( ) ) ; } // Prepare the content to generate
Defaults def = new Defaults ( ) ; StringBuilder sb = new StringBuilder ( ) ; for ( PreferenceKeyCategory cat : PreferenceKeyCategory . values ( ) ) { sb . append ( "\n###\n# " ) ; sb . append ( cat . getDescription ( ) ) ; sb . append ( "\n###\n" ) ; for ( Map . Entry < String , PreferenceKeyCategory > entry : def . keyToCategory . entrySet ( ) ) { if ( cat != entry . getValue ( ) ) continue ; String comment = propertyNameToComment . get ( entry . getKey ( ) ) ; comment = comment . replaceAll ( "^" , "# " ) . replace ( "\n" , "\n# " ) ; sb . append ( "\n" ) ; sb . append ( comment ) ; sb . append ( "\n" ) ; sb . append ( entry . getKey ( ) ) ; sb . append ( " = " ) ; String defaultValue = def . keyToDefaultValue . get ( entry . getKey ( ) ) ; if ( ! Utils . isEmptyOrWhitespaces ( defaultValue ) ) sb . append ( defaultValue . trim ( ) ) ; sb . append ( "\n" ) ; } sb . append ( "\n" ) ; } // Update the file
Utils . appendStringInto ( sb . toString ( ) , targetFile ) ; |
public class BioAssemblyTools { /** * Expands a range expression , i . e . ( 1-6 ) to a list 1,2,3,4,5,6
* @ param expression the expression to be expanded
* @ return list of items in range
* @ throws IllegalArgumentException */
private static List < String > expandRange ( String expression ) throws IllegalArgumentException { } } | int first = 0 ; int last = 0 ; try { String [ ] range = expression . split ( "-" ) ; first = Integer . parseInt ( range [ 0 ] ) ; last = Integer . parseInt ( range [ 1 ] ) ; } catch ( Exception e ) { throw new IllegalArgumentException ( "Invalid range specification in oper_expression: " + expression ) ; } List < String > expandedExpression = new ArrayList < String > ( last - first + 1 ) ; for ( int i = first ; i <= last ; i ++ ) { expandedExpression . add ( String . valueOf ( i ) ) ; } return expandedExpression ; |
public class PersistentTimerTaskHandler { /** * Validate that the method corresponding to the method ID stored in the
* database matches the method that was used when the automatic timer was
* created . For example , this validation will fail if the application is
* changed to remove an automatic timer without clearing the timers from
* the database . As a prerequisite to calling this method , this object
* must be an automatic timer .
* @ param bmd the bean metadata
* @ return true if this automatic timer is valid , or false if not */
private boolean validateAutomaticTimer ( BeanMetaData bmd ) { } } | if ( bmd . timedMethodInfos == null || methodId > bmd . timedMethodInfos . length ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "validateAutomaticTimer: ivMethodId=" + methodId + " > " + Arrays . toString ( bmd . timedMethodInfos ) ) ; return false ; } Method method = bmd . timedMethodInfos [ methodId ] . ivMethod ; if ( ! method . getName ( ) . equals ( automaticMethodName ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "validateAutomaticTimer: ivAutomaticMethodName=" + automaticMethodName + " != " + method . getName ( ) ) ; return false ; } if ( automaticClassName != null && ! automaticClassName . equals ( method . getDeclaringClass ( ) . getName ( ) ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "validateAutomaticTimer: ivAutomaticClassName=" + automaticClassName + " != " + method . getDeclaringClass ( ) . getName ( ) ) ; return false ; } return true ; |
public class NormalizedToPixelError { /** * Specify camera intrinsic parameters
* @ param fx focal length x
* @ param fy focal length y
* @ param skew camera skew */
public void set ( double fx , double fy , double skew ) { } } | this . fx = fx ; this . fy = fy ; this . skew = skew ; |
public class GenericQueue { /** * attempt to retrieve message from queue head */
public Object tryGet ( ) { } } | Object o = null ; if ( head != null ) { o = head . getContents ( ) ; head = head . getNext ( ) ; count -- ; if ( head == null ) { tail = null ; count = 0 ; } } return o ; |
public class CPDefinitionOptionRelLocalServiceWrapper { /** * Returns the cp definition option rel matching the UUID and group .
* @ param uuid the cp definition option rel ' s UUID
* @ param groupId the primary key of the group
* @ return the matching cp definition option rel , or < code > null < / code > if a matching cp definition option rel could not be found */
@ Override public com . liferay . commerce . product . model . CPDefinitionOptionRel fetchCPDefinitionOptionRelByUuidAndGroupId ( String uuid , long groupId ) { } } | return _cpDefinitionOptionRelLocalService . fetchCPDefinitionOptionRelByUuidAndGroupId ( uuid , groupId ) ; |
public class AppServiceEnvironmentsInner { /** * Create or update a multi - role pool .
* Create or update a multi - role pool .
* @ param resourceGroupName Name of the resource group to which the resource belongs .
* @ param name Name of the App Service Environment .
* @ param multiRolePoolEnvelope Properties of the multi - role pool .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the WorkerPoolResourceInner object */
public Observable < WorkerPoolResourceInner > beginCreateOrUpdateMultiRolePoolAsync ( String resourceGroupName , String name , WorkerPoolResourceInner multiRolePoolEnvelope ) { } } | return beginCreateOrUpdateMultiRolePoolWithServiceResponseAsync ( resourceGroupName , name , multiRolePoolEnvelope ) . map ( new Func1 < ServiceResponse < WorkerPoolResourceInner > , WorkerPoolResourceInner > ( ) { @ Override public WorkerPoolResourceInner call ( ServiceResponse < WorkerPoolResourceInner > response ) { return response . body ( ) ; } } ) ; |
public class GeoPackageGeometryData { /** * Build the flags byte from the flag values
* @ return envelope indicator */
private byte buildFlagsByte ( ) { } } | byte flag = 0 ; // Add the binary type to bit 5 , 0 for standard and 1 for extended
int binaryType = extended ? 1 : 0 ; flag += ( binaryType << 5 ) ; // Add the empty geometry flag to bit 4 , 0 for non - empty and 1 for
// empty
int emptyValue = empty ? 1 : 0 ; flag += ( emptyValue << 4 ) ; // Add the envelope contents indicator code ( 3 - bit unsigned integer to
// bits 3 , 2 , and 1)
int envelopeIndicator = envelope == null ? 0 : getIndicator ( envelope ) ; flag += ( envelopeIndicator << 1 ) ; // Add the byte order to bit 0 , 0 for Big Endian and 1 for Little
// Endian
int byteOrderValue = ( byteOrder == ByteOrder . BIG_ENDIAN ) ? 0 : 1 ; flag += byteOrderValue ; return flag ; |
public class FaunusPipeline { /** * Emit the label of the current edge .
* @ return the extended FaunusPipeline */
public FaunusPipeline label ( ) { } } | this . state . assertNotLocked ( ) ; this . state . assertNoProperty ( ) ; this . state . assertAtEdge ( ) ; this . property ( Tokens . LABEL , String . class ) ; return this ; |
public class CPRulePersistenceImpl { /** * Caches the cp rules in the entity cache if it is enabled .
* @ param cpRules the cp rules */
@ Override public void cacheResult ( List < CPRule > cpRules ) { } } | for ( CPRule cpRule : cpRules ) { if ( entityCache . getResult ( CPRuleModelImpl . ENTITY_CACHE_ENABLED , CPRuleImpl . class , cpRule . getPrimaryKey ( ) ) == null ) { cacheResult ( cpRule ) ; } else { cpRule . resetOriginalValues ( ) ; } } |
public class GrammarFactory { /** * Schema information is generated for processing the EXI body .
* @ param is
* input stream
* @ param entityResolver
* application can register XSD resolver
* @ return schema - informed EXI grammars
* @ throws EXIException
* EXI exception */
public Grammars createGrammars ( InputStream is , XMLEntityResolver entityResolver ) throws EXIException { } } | grammarBuilder . loadGrammars ( is , entityResolver ) ; SchemaInformedGrammars g = grammarBuilder . toGrammars ( ) ; g . setSchemaId ( "No-Schema-ID-Set" ) ; return g ; |
public class WorkbenchPanel { /** * Removes the given panels of given panel type from the workbench panel .
* @ param panels the panels to remove from the workbench panel
* @ param panelType the type of the panels
* @ throws IllegalArgumentException if any of the parameters is { @ code null } .
* @ since 2.5.0
* @ see # addPanels ( List , PanelType )
* @ see # removePanel ( AbstractPanel , PanelType ) */
public void removePanels ( List < AbstractPanel > panels , PanelType panelType ) { } } | validateNotNull ( panels , "panels" ) ; validateNotNull ( panelType , "panelType" ) ; removePanels ( getTabbedFull ( ) , panels ) ; switch ( panelType ) { case SELECT : removePanels ( getTabbedSelect ( ) , panels ) ; break ; case STATUS : removePanels ( getTabbedStatus ( ) , panels ) ; break ; case WORK : removePanels ( getTabbedWork ( ) , panels ) ; break ; default : break ; } |
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EClass getIfcBoolean ( ) { } } | if ( ifcBooleanEClass == null ) { ifcBooleanEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 785 ) ; } return ifcBooleanEClass ; |
public class NetworkInterfacesInner { /** * Gets information about all network interfaces in a virtual machine in a virtual machine scale set .
* @ param resourceGroupName The name of the resource group .
* @ param virtualMachineScaleSetName The name of the virtual machine scale set .
* @ param virtualmachineIndex The virtual machine index .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws CloudException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the PagedList & lt ; NetworkInterfaceInner & gt ; object if successful . */
public PagedList < NetworkInterfaceInner > listVirtualMachineScaleSetVMNetworkInterfaces ( final String resourceGroupName , final String virtualMachineScaleSetName , final String virtualmachineIndex ) { } } | ServiceResponse < Page < NetworkInterfaceInner > > response = listVirtualMachineScaleSetVMNetworkInterfacesSinglePageAsync ( resourceGroupName , virtualMachineScaleSetName , virtualmachineIndex ) . toBlocking ( ) . single ( ) ; return new PagedList < NetworkInterfaceInner > ( response . body ( ) ) { @ Override public Page < NetworkInterfaceInner > nextPage ( String nextPageLink ) { return listVirtualMachineScaleSetVMNetworkInterfacesNextSinglePageAsync ( nextPageLink ) . toBlocking ( ) . single ( ) . body ( ) ; } } ; |
public class AbstractFilePickerFragment { /** * Called when the fragment ' s activity has been created and this
* fragment ' s view hierarchy instantiated . It can be used to do final
* initialization once these pieces are in place , such as retrieving
* views or restoring state . It is also useful for fragments that use
* { @ link # setRetainInstance ( boolean ) } to retain their instance ,
* as this callback tells the fragment when it is fully associated with
* the new activity instance . This is called after { @ link # onCreateView }
* and before { @ link # onViewStateRestored ( Bundle ) } .
* @ param savedInstanceState If the fragment is being re - created from
* a previous saved state , this is the state . */
@ Override public void onActivityCreated ( Bundle savedInstanceState ) { } } | super . onActivityCreated ( savedInstanceState ) ; // Only if we have no state
if ( mCurrentPath == null ) { if ( savedInstanceState != null ) { mode = savedInstanceState . getInt ( KEY_MODE , mode ) ; allowCreateDir = savedInstanceState . getBoolean ( KEY_ALLOW_DIR_CREATE , allowCreateDir ) ; allowMultiple = savedInstanceState . getBoolean ( KEY_ALLOW_MULTIPLE , allowMultiple ) ; allowExistingFile = savedInstanceState . getBoolean ( KEY_ALLOW_EXISTING_FILE , allowExistingFile ) ; singleClick = savedInstanceState . getBoolean ( KEY_SINGLE_CLICK , singleClick ) ; String path = savedInstanceState . getString ( KEY_CURRENT_PATH ) ; if ( path != null ) { mCurrentPath = getPath ( path . trim ( ) ) ; } } else if ( getArguments ( ) != null ) { mode = getArguments ( ) . getInt ( KEY_MODE , mode ) ; allowCreateDir = getArguments ( ) . getBoolean ( KEY_ALLOW_DIR_CREATE , allowCreateDir ) ; allowMultiple = getArguments ( ) . getBoolean ( KEY_ALLOW_MULTIPLE , allowMultiple ) ; allowExistingFile = getArguments ( ) . getBoolean ( KEY_ALLOW_EXISTING_FILE , allowExistingFile ) ; singleClick = getArguments ( ) . getBoolean ( KEY_SINGLE_CLICK , singleClick ) ; if ( getArguments ( ) . containsKey ( KEY_START_PATH ) ) { String path = getArguments ( ) . getString ( KEY_START_PATH ) ; if ( path != null ) { T file = getPath ( path . trim ( ) ) ; if ( isDir ( file ) ) { mCurrentPath = file ; } else { mCurrentPath = getParent ( file ) ; mEditTextFileName . setText ( getName ( file ) ) ; } } } } } setModeView ( ) ; // If still null
if ( mCurrentPath == null ) { mCurrentPath = getRoot ( ) ; } refresh ( mCurrentPath ) ; |
public class CollectionUtil { /** * Removes objects in array to the given collection
* @ return the same collection which is passed as argument */
@ SuppressWarnings ( "unchecked" ) public static < E , T extends E > Collection < E > removeAll ( Collection < E > c , T ... array ) { } } | for ( T obj : array ) c . remove ( obj ) ; return c ; |
public class CmsCoreProvider { /** * Gets the content attribute of a meta tag with a given name . < p >
* @ param nameToFind the name of the meta tag
* @ return the content attribute value of the found meta tag , or null if no meta tag with the given name was found */
public static String getMetaElementContent ( String nameToFind ) { } } | NodeList < Element > metas = Document . get ( ) . getDocumentElement ( ) . getElementsByTagName ( "meta" ) ; for ( int i = 0 ; i < metas . getLength ( ) ; i ++ ) { Element meta = metas . getItem ( i ) ; String name = meta . getAttribute ( "name" ) ; if ( nameToFind . equals ( name ) ) { return meta . getAttribute ( "content" ) ; } } return null ; |
public class ProcessDomainMojo { /** * Calls super . execute ( ) , then process the configured classpaths */
@ Override public void execute ( ) throws MojoExecutionException , MojoFailureException { } } | super . execute ( ) ; // scan classes and build graph
try { processClasspaths ( ) ; } catch ( Exception e ) { throw new MojoExecutionException ( "Error processing entity classes" , e ) ; } |
public class AbstractFontManager { /** * For a particular zoom , get the appropriate font size .
* @ param zoom the zoom level
* @ return an integer font size */
protected Integer getFontSizeForZoom ( double zoom ) { } } | double lower = - 1 ; for ( double upper : this . zoomToFontSizeMap . keySet ( ) ) { if ( lower == - 1 ) { lower = upper ; if ( zoom <= lower ) return this . zoomToFontSizeMap . get ( upper ) ; continue ; } if ( zoom > lower && zoom <= upper ) { return this . zoomToFontSizeMap . get ( upper ) ; } lower = upper ; } return this . zoomToFontSizeMap . get ( lower ) ; |
public class FacesImpl { /** * Verify whether two faces belong to a same person . Compares a face Id with a Person Id .
* @ param faceId FaceId the face , comes from Face - Detect
* @ param personGroupId Using existing personGroupId and personId for fast loading a specified person . personGroupId is created in Person Groups . Create .
* @ param personId Specify a certain person in a person group . personId is created in Persons . Create .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws APIErrorException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the VerifyResult object if successful . */
public VerifyResult verifyFaceToPerson ( UUID faceId , String personGroupId , UUID personId ) { } } | return verifyFaceToPersonWithServiceResponseAsync ( faceId , personGroupId , personId ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class SpringConfigProcessor { /** * lifecycle .
* @ param registry a { @ link org . beangle . commons . inject . bind . BindRegistry } object .
* @ param definitionRegistry a
* { @ link org . springframework . beans . factory . support . BeanDefinitionRegistry } object . */
protected void lifecycle ( BindRegistry registry , BeanDefinitionRegistry definitionRegistry ) { } } | for ( String name : registry . getBeanNames ( ) ) { Class < ? > clazz = registry . getBeanType ( name ) ; String springName = name ; if ( springName . startsWith ( "&" ) ) springName = springName . substring ( 1 ) ; if ( ! definitionRegistry . containsBeanDefinition ( springName ) ) continue ; AbstractBeanDefinition def = ( AbstractBeanDefinition ) definitionRegistry . getBeanDefinition ( springName ) ; if ( Initializing . class . isAssignableFrom ( clazz ) && null == def . getInitMethodName ( ) && ! def . getPropertyValues ( ) . contains ( "init-method" ) ) { def . setInitMethodName ( "init" ) ; } if ( Disposable . class . isAssignableFrom ( clazz ) && null == def . getDestroyMethodName ( ) && ! def . getPropertyValues ( ) . contains ( "destroy-method" ) ) { def . setDestroyMethodName ( "destroy" ) ; } } |
public class ServerGroupChooser { /** * Return the command line argument
* @ return " - - server - groups = " plus a comma - separated list
* of selected server groups . Return empty String if none selected . */
public String getCmdLineArg ( ) { } } | StringBuilder builder = new StringBuilder ( " --server-groups=" ) ; boolean foundSelected = false ; for ( JCheckBox serverGroup : serverGroups ) { if ( serverGroup . isSelected ( ) ) { foundSelected = true ; builder . append ( serverGroup . getText ( ) ) ; builder . append ( "," ) ; } } builder . deleteCharAt ( builder . length ( ) - 1 ) ; // remove trailing comma
if ( ! foundSelected ) return "" ; return builder . toString ( ) ; |
public class VTimeZone { /** * Write start times defined by a DOW rule using VTIMEZONE RRULE */
private static void writeZonePropsByDOW ( Writer writer , boolean isDst , String tzname , int fromOffset , int toOffset , int month , int weekInMonth , int dayOfWeek , long startTime , long untilTime ) throws IOException { } } | beginZoneProps ( writer , isDst , tzname , fromOffset , toOffset , startTime ) ; beginRRULE ( writer , month ) ; writer . write ( ICAL_BYDAY ) ; writer . write ( EQUALS_SIGN ) ; writer . write ( Integer . toString ( weekInMonth ) ) ; // -4 , - 3 , - 2 , - 1 , 1 , 2 , 3 , 4
writer . write ( ICAL_DOW_NAMES [ dayOfWeek - 1 ] ) ; // SU , MO , TU . . .
if ( untilTime != MAX_TIME ) { appendUNTIL ( writer , getDateTimeString ( untilTime + fromOffset ) ) ; } writer . write ( NEWLINE ) ; endZoneProps ( writer , isDst ) ; |
public class DivSufSort { /** * Returns the median of five elements */
private int ssMedian5 ( int Td , int PA , int v1 , int v2 , int v3 , int v4 , int v5 ) { } } | int t ; if ( T [ start + Td + SA [ PA + SA [ v2 ] ] ] > T [ start + Td + SA [ PA + SA [ v3 ] ] ] ) { t = v2 ; v2 = v3 ; v3 = t ; } if ( T [ start + Td + SA [ PA + SA [ v4 ] ] ] > T [ start + Td + SA [ PA + SA [ v5 ] ] ] ) { t = v4 ; v4 = v5 ; v5 = t ; } if ( T [ start + Td + SA [ PA + SA [ v2 ] ] ] > T [ start + Td + SA [ PA + SA [ v4 ] ] ] ) { t = v2 ; v2 = v4 ; v4 = t ; t = v3 ; v3 = v5 ; v5 = t ; } if ( T [ start + Td + SA [ PA + SA [ v1 ] ] ] > T [ start + Td + SA [ PA + SA [ v3 ] ] ] ) { t = v1 ; v1 = v3 ; v3 = t ; } if ( T [ start + Td + SA [ PA + SA [ v1 ] ] ] > T [ start + Td + SA [ PA + SA [ v4 ] ] ] ) { t = v1 ; v1 = v4 ; v4 = t ; t = v3 ; v3 = v5 ; v5 = t ; } if ( T [ start + Td + SA [ PA + SA [ v3 ] ] ] > T [ start + Td + SA [ PA + SA [ v4 ] ] ] ) { return v4 ; } return v3 ; |
public class AttributesImpl { /** * Add an attribute to the end of the list .
* < p > For the sake of speed , this method does no checking
* to see if the attribute is already in the list : that is
* the responsibility of the application . < / p >
* @ param uri The Namespace URI , or the empty string if
* none is available or Namespace processing is not
* being performed .
* @ param localName The local name , or the empty string if
* Namespace processing is not being performed .
* @ param qName The qualified ( prefixed ) name , or the empty string
* if qualified names are not available .
* @ param type The attribute type as a string .
* @ param value The attribute value . */
public void addAttribute ( String uri , String localName , String qName , String type , String value ) { } } | ensureCapacity ( length + 1 ) ; data [ length * 5 ] = uri ; data [ length * 5 + 1 ] = localName ; data [ length * 5 + 2 ] = qName ; data [ length * 5 + 3 ] = type ; data [ length * 5 + 4 ] = value ; length ++ ; |
public class ImplementorWrapper { /** * prueft , ob uebergebene Klasse < code > assignable < / code > von aktueller
* Klasse ist . */
public < X > X cast ( final Class < X > iface ) { } } | if ( iface == null ) { throw new IllegalArgumentException ( "Parameter 'cls' muss angegeben werden" ) ; } final Class < ? > clazz = this . getClass ( ) ; if ( iface . isAssignableFrom ( clazz ) ) { return iface . cast ( this ) ; } else { if ( this . editable == null ) { throw new IllegalStateException ( "Delegate ist nicht definiert" ) ; } return this . editable . cast ( iface ) ; } |
public class ApplicationVersion { /** * Append a description for this version .
* @ param _ desc text of description to append
* @ see # description */
@ CallMethod ( pattern = "install/version/description" ) public void appendDescription ( @ CallParam ( pattern = "install/version/description" ) final String _desc ) { } } | if ( _desc != null ) { this . description . append ( _desc . trim ( ) ) . append ( "\n" ) ; } |
public class LocalSubscriptionControl { /** * / * ( non - Javadoc )
* @ see com . ibm . ws . sib . admin . Controllable # getId ( ) */
public String getId ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getId" ) ; String id = consumerDispatcher . getSubscriptionUuid ( ) . toString ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getId" , id ) ; return id ; |
public class FNIRGImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public void setAscendHt ( Integer newAscendHt ) { } } | Integer oldAscendHt = ascendHt ; ascendHt = newAscendHt ; if ( eNotificationRequired ( ) ) eNotify ( new ENotificationImpl ( this , Notification . SET , AfplibPackage . FNIRG__ASCEND_HT , oldAscendHt , ascendHt ) ) ; |
public class GeldbetragFactory { /** * Erzeugt einen neuen { @ link Geldbetrag } anhand der eingestellten Daten .
* @ return den entsprechenden { @ link Geldbetrag } .
* @ see # getAmountType ( ) */
@ Override public Geldbetrag create ( ) { } } | if ( currency == null ) { throw new LocalizedMonetaryException ( "currency missing" , number ) ; } return Geldbetrag . valueOf ( number , currency , context ) ; |
public class SARLJvmModelInferrer { /** * Create the functions that are related to the < code > toString < / code > function .
* @ param context the current generation context .
* @ param source the source object .
* @ param target the inferred JVM object . */
protected void appendToStringFunctions ( GenerationContext context , XtendTypeDeclaration source , final JvmGenericType target ) { } } | if ( ! isAppendToStringFunctionsEnable ( context ) ) { return ; } // Create a list of the declared non - static fields .
final List < JvmField > declaredInstanceFields = new ArrayList < > ( ) ; for ( final JvmField field : target . getDeclaredFields ( ) ) { if ( ! field . isStatic ( ) ) { declaredInstanceFields . add ( field ) ; } } if ( ! declaredInstanceFields . isEmpty ( ) ) { final JvmTypeReference voidType = this . _typeReferenceBuilder . typeRef ( Void . TYPE ) ; final JvmOperation op = SARLJvmModelInferrer . this . typeBuilder . toMethod ( source , "toString" , // $ NON - NLS - 1 $
voidType , it2 -> { it2 . setVisibility ( JvmVisibility . PROTECTED ) ; SARLJvmModelInferrer . this . typeBuilder . setDocumentation ( it2 , MessageFormat . format ( Messages . SARLJvmModelInferrer_2 , target . getSimpleName ( ) ) ) ; final JvmFormalParameter param = this . typesFactory . createJvmFormalParameter ( ) ; param . setName ( "builder" ) ; // $ NON - NLS - 1 $
param . setParameterType ( SARLJvmModelInferrer . this . _typeReferenceBuilder . typeRef ( ToStringBuilder . class ) ) ; it2 . getParameters ( ) . add ( param ) ; setBody ( it2 , it3 -> { it3 . append ( "super.toString(builder);" ) ; // $ NON - NLS - 1 $
for ( final JvmField attr : declaredInstanceFields ) { it3 . newLine ( ) ; it3 . append ( "builder.add(\"" + attr . getSimpleName ( ) // $ NON - NLS - 1 $
+ "\", this." // $ NON - NLS - 1 $
+ attr . getSimpleName ( ) + ");" ) ; // $ NON - NLS - 1 $
} } ) ; } ) ; if ( op != null ) { appendGeneratedAnnotation ( op , context ) ; if ( context . getGeneratorConfig2 ( ) . isGeneratePureAnnotation ( ) ) { addAnnotationSafe ( op , Pure . class ) ; } target . getMembers ( ) . add ( op ) ; } } |
public class Representations { /** * Add a link to this resource
* @ param rel
* @ param uri The target URI for the link , possibly relative to the href of this resource . */
public static void withLink ( Representation representation , String rel , URI uri , Predicate < ReadableRepresentation > predicate ) { } } | withLink ( representation , rel , uri . toASCIIString ( ) , predicate ) ; |
public class HtmlDocletWriter { /** * Adds the summary content .
* @ param doc the doc for which the summary will be generated
* @ param firstSentenceTags the first sentence tags for the doc
* @ param htmltree the documentation tree to which the summary will be added */
public void addSummaryComment ( Doc doc , Tag [ ] firstSentenceTags , Content htmltree ) { } } | addCommentTags ( doc , firstSentenceTags , false , true , htmltree ) ; |
public class DatabaseReader { /** * Look up an IP address in a GeoIP2 ISP database .
* @ param ipAddress IPv4 or IPv6 address to lookup .
* @ return an IspResponse for the requested IP address .
* @ throws GeoIp2Exception if there is an error looking up the IP
* @ throws IOException if there is an IO error */
@ Override public IspResponse isp ( InetAddress ipAddress ) throws IOException , GeoIp2Exception { } } | return this . get ( ipAddress , IspResponse . class , "GeoIP2-ISP" ) ; |
public class FileUtil { /** * Reads content of UTF - 8 file on classpath to String .
* @ param filename file to read .
* @ return file ' s content .
* @ throws IllegalArgumentException if file could not be found .
* @ throws IllegalStateException if file could not be read . */
public static String loadFile ( String filename ) { } } | ClassLoader classLoader = Thread . currentThread ( ) . getContextClassLoader ( ) ; InputStream is = classLoader . getResourceAsStream ( filename ) ; if ( is == null ) { throw new IllegalArgumentException ( "Unable to locate: " + filename ) ; } return streamToString ( is , filename ) ; |
public class WiresConnectorControlImpl { /** * * * * * * CONTROL POINTS * * * * * */
@ Override public void reset ( ) { } } | if ( null != m_startPoints ) { final IControlHandleList handles = m_connector . getPointHandles ( ) ; final Point2DArray points = m_connector . getLine ( ) . getPoint2DArray ( ) ; for ( int i = 0 , j = 0 ; i < handles . size ( ) ; i ++ , j += 2 ) { final double px = m_startPoints . get ( j ) ; final double py = m_startPoints . get ( j + 1 ) ; final IControlHandle h = handles . getHandle ( i ) ; final IPrimitive < ? > prim = h . getControl ( ) ; prim . setX ( px ) ; prim . setY ( py ) ; final Point2D point = points . get ( i ) ; point . setX ( px ) ; point . setY ( py ) ; } } m_connector . getLine ( ) . refresh ( ) ; m_wiresManager . getLayer ( ) . getLayer ( ) . batch ( ) ; |
public class Loader { @ Override public ResourceSchema getSchema ( String location , Job job ) throws IOException { } } | ResourceSchema rs = new ResourceSchema ( ) ; List < ResourceFieldSchema > fieldSchemaList = new ArrayList < > ( ) ; for ( String fieldName : requestedFields ) { ResourceFieldSchema rfs = new ResourceFieldSchema ( ) ; rfs . setName ( fieldName ) ; rfs . setDescription ( fieldName ) ; if ( fieldName . endsWith ( ".*" ) ) { rfs . setType ( DataType . MAP ) ; } else { EnumSet < Casts > casts = theInputFormat . getRecordReader ( ) . getCasts ( fieldName ) ; if ( casts != null ) { if ( casts . contains ( Casts . LONG ) ) { rfs . setType ( DataType . LONG ) ; } else { if ( casts . contains ( Casts . DOUBLE ) ) { rfs . setType ( DataType . DOUBLE ) ; } else { rfs . setType ( DataType . CHARARRAY ) ; } } } else { rfs . setType ( DataType . BYTEARRAY ) ; } } fieldSchemaList . add ( rfs ) ; } rs . setFields ( fieldSchemaList . toArray ( new ResourceFieldSchema [ fieldSchemaList . size ( ) ] ) ) ; return rs ; |
public class CmsPropertyDeleteDialog { /** * Gets a copy of the cms object set to root site . < p >
* @ return CmsObject */
protected CmsObject getCms ( ) { } } | if ( m_cms == null ) { try { m_cms = OpenCms . initCmsObject ( A_CmsUI . getCmsObject ( ) ) ; m_cms . getRequestContext ( ) . setSiteRoot ( "" ) ; } catch ( CmsException e ) { return null ; } } return m_cms ; |
public class LibraryCacheManager { /** * Checks if the given library is in the local cache .
* @ param cacheName
* The name of the library to be checked for .
* @ return the path object of the library if it is cached , < code > null < / code > otherwise
* @ throws IOException
* thrown if no access to the file system could be obtained */
private Path containsInternal ( final String cacheName ) throws IOException { } } | // Create a path object from the external name string
final Path p = new Path ( this . libraryCachePath + File . separator + cacheName ) ; synchronized ( this . fs ) { if ( fs . exists ( p ) ) { return p ; } } return null ; |
public class CPAttachmentFileEntryPersistenceImpl { /** * Removes all the cp attachment file entries where displayDate & lt ; & # 63 ; and status = & # 63 ; from the database .
* @ param displayDate the display date
* @ param status the status */
@ Override public void removeByLtD_S ( Date displayDate , int status ) { } } | for ( CPAttachmentFileEntry cpAttachmentFileEntry : findByLtD_S ( displayDate , status , QueryUtil . ALL_POS , QueryUtil . ALL_POS , null ) ) { remove ( cpAttachmentFileEntry ) ; } |
public class UpgradeScanner10 { /** * Reads data for a leaf .
* < code > < pre >
* blobLen int16
* blobData { blobLen }
* rowLen int16
* rowData { rowLen }
* < / pre > < / code > */
private void upgradeLeafBlock ( ReadStream is , TableEntry10 table , TableUpgrade upgradeTable , Page10 page ) throws IOException { } } | TempBuffer tBuf = TempBuffer . create ( ) ; byte [ ] buffer = tBuf . buffer ( ) ; int blobLen = BitsUtil . readInt16 ( is ) ; is . readAll ( buffer , 0 , blobLen ) ; int rowDataLen = BitsUtil . readInt16 ( is ) ; int rowOffset = buffer . length - rowDataLen ; is . readAll ( buffer , rowOffset , rowDataLen ) ; int rowLen = table . rowLength ( ) ; int keyLen = table . keyLength ( ) ; while ( rowOffset < buffer . length ) { int code = buffer [ rowOffset ] & CODE_MASK ; switch ( code ) { case INSERT : rowInsert ( table . row ( ) , upgradeTable , buffer , rowOffset ) ; rowOffset += rowLen ; break ; case REMOVE : rowOffset += keyLen + STATE_LENGTH ; break ; default : System . out . println ( "UNKNOWN: " + Integer . toHexString ( code ) ) ; return ; } } tBuf . free ( ) ; |
public class HttpHeaders { /** * Set a header .
* if header with same name already exists then the value will be overwritten .
* if value is null and header with provided name already exists then it will be removed .
* @ param name the name
* @ param value the value
* @ return this HttpHeaders */
public HttpHeaders set ( String name , String value ) { } } | final String headerKey = name . toLowerCase ( Locale . ROOT ) ; if ( value == null ) { headers . remove ( headerKey ) ; } else { headers . put ( headerKey , new HttpHeader ( name , value ) ) ; } return this ; |
public class JQMTable { /** * Adds the given { @ link Widget } before the given position .
* This is an O ( n ) operation because after the widget is inserted all the
* remaining cells need to have their style sheets updated to reflect
* their new position . */
public Widget insert ( Widget w , int beforeIndex ) { } } | FlowPanel widgetWrapper = new FlowPanel ( ) ; widgetWrapper . getElement ( ) . setId ( Document . get ( ) . createUniqueId ( ) ) ; widgetWrapper . add ( w ) ; flow . insert ( w , beforeIndex ) ; JQMContext . render ( widgetWrapper . getElement ( ) . getId ( ) ) ; rebase ( ) ; return widgetWrapper ; |
public class QrStructuralCounts_DSCC { /** * Non - zero counts of Householder vectors and computes a permutation
* matrix that ensures diagonal entires are all structurally nonzero .
* @ param parent elimination tree
* @ param ll linked list for each row that specifies elements that are not zero */
void countNonZeroUsingLinkedList ( int parent [ ] , int ll [ ] ) { } } | Arrays . fill ( pinv , 0 , m , - 1 ) ; nz_in_V = 0 ; m2 = m ; for ( int k = 0 ; k < n ; k ++ ) { int i = ll [ head + k ] ; // remove row i from queue k
nz_in_V ++ ; // count V ( k , k ) as nonzero
if ( i < 0 ) // add a fictitious row since there are no nz elements
i = m2 ++ ; pinv [ i ] = k ; // associate row i with V ( : , k )
if ( -- ll [ nque + k ] <= 0 ) continue ; nz_in_V += ll [ nque + k ] ; int pa ; if ( ( pa = parent [ k ] ) != - 1 ) { // move all rows to parent of k
if ( ll [ nque + pa ] == 0 ) ll [ tail + pa ] = ll [ tail + k ] ; ll [ next + ll [ tail + k ] ] = ll [ head + pa ] ; ll [ head + pa ] = ll [ next + i ] ; ll [ nque + pa ] += ll [ nque + k ] ; } } for ( int i = 0 , k = n ; i < m ; i ++ ) { if ( pinv [ i ] < 0 ) pinv [ i ] = k ++ ; } if ( nz_in_V < 0 ) throw new RuntimeException ( "Too many elements. Numerical overflow in V counts" ) ; |
public class Nodes { /** * Centers a node that is inside an enclosing { @ link AnchorPane } .
* @ param node The node to center
* @ param marginSize The margins to keep on the sides */
public static void centerNode ( final Node node , final Double marginSize ) { } } | AnchorPane . setTopAnchor ( node , marginSize ) ; AnchorPane . setBottomAnchor ( node , marginSize ) ; AnchorPane . setLeftAnchor ( node , marginSize ) ; AnchorPane . setRightAnchor ( node , marginSize ) ; |
public class SiteProperties { /** * Returns true if full content model type conversion should be disabled .
* Up to and including version 2:
* Crafter Engine , in the FreeMarker host only , converts model elements based on a suffix type hint , but only for the first level in
* the model , and not for _ dt . For example , for contentModel . myvalue _ i Integer is returned , but for contentModel . repeater . myvalue _ i
* and contentModel . date _ dt a String is returned . In the Groovy host no type of conversion was performed .
* In version 3 onwards , Crafter Engine converts elements with any suffix type hints ( including _ dt ) at at any level in the content
* model and for both Freemarker and Groovy hosts . */
public static boolean isDisableFullModelTypeConversion ( ) { } } | Configuration config = ConfigUtils . getCurrentConfig ( ) ; if ( config != null ) { return config . getBoolean ( DISABLE_FULL_MODEL_TYPE_CONVERSION_CONFIG_KEY , false ) ; } else { return false ; } |
public class YearMonth { /** * Handle broken serialization from other tools .
* @ return the resolved object , not null */
private Object readResolve ( ) { } } | if ( DateTimeZone . UTC . equals ( getChronology ( ) . getZone ( ) ) == false ) { return new YearMonth ( this , getChronology ( ) . withUTC ( ) ) ; } return this ; |
public class DynaFormModel { /** * Removes the passed extended row .
* @ param rowToBeRemoved { @ link DynaFormRow } to be removed */
public void removeExtendedRow ( final DynaFormRow rowToBeRemoved ) { } } | final int idx = rowToBeRemoved != null ? extendedRows . indexOf ( rowToBeRemoved ) : - 1 ; if ( idx >= 0 ) { removeRow ( extendedRows , rowToBeRemoved , idx ) ; } |
public class JobHistoryRawService { /** * creates a Get to be fetch daily aggregation status from the RAW table
* @ param row key
* @ return { @ link Get }
* @ throws IOException */
public boolean getStatusAgg ( byte [ ] row , byte [ ] col ) throws IOException { } } | Get g = new Get ( row ) ; g . addColumn ( Constants . INFO_FAM_BYTES , col ) ; Table rawTable = null ; Cell cell = null ; try { rawTable = hbaseConnection . getTable ( TableName . valueOf ( Constants . HISTORY_RAW_TABLE ) ) ; Result r = rawTable . get ( g ) ; cell = r . getColumnLatestCell ( Constants . INFO_FAM_BYTES , col ) ; } finally { if ( rawTable != null ) { rawTable . close ( ) ; } } boolean status = false ; try { if ( cell != null ) { status = Bytes . toBoolean ( CellUtil . cloneValue ( cell ) ) ; } } catch ( IllegalArgumentException iae ) { LOG . error ( "Caught " + iae ) ; } LOG . info ( "Returning from Raw, " + Bytes . toString ( col ) + " for this job=" + status ) ; return status ; |
public class TextRankSentence { /** * 获取前几个关键句子
* @ param size 要几个
* @ return 关键句子的下标 */
public int [ ] getTopSentence ( int size ) { } } | Collection < Integer > values = top . values ( ) ; size = Math . min ( size , values . size ( ) ) ; int [ ] indexArray = new int [ size ] ; Iterator < Integer > it = values . iterator ( ) ; for ( int i = 0 ; i < size ; ++ i ) { indexArray [ i ] = it . next ( ) ; } return indexArray ; |
public class MultiWordMatcher { /** * Get the dictionary for the { @ code MultiWordMatcher } .
* @ param lang
* the language
* @ param resourcesDirectory
* the directory where the dictionary can be found .
* If { @ code null } , load from package resources .
* @ return the inputstream of the dictionary */
private final InputStream getMultiWordDict ( final String lang , final String resourcesDirectory ) { } } | return resourcesDirectory == null ? getMultiWordDictFromResources ( lang ) : getMultiWordDictFromDirectory ( lang , resourcesDirectory ) ; |
public class KMedoidsPark { /** * Returns a list of clusters . The k < sup > th < / sup > cluster contains the ids of
* those FeatureVectors , that are nearest to the k < sup > th < / sup > mean .
* @ param miter Iterator over the medoids
* @ param dsum Distance sums
* @ param clusters cluster assignment
* @ param distQ distance query
* @ return cost */
protected double assignToNearestCluster ( DBIDArrayIter miter , double [ ] dsum , List < ? extends ModifiableDBIDs > clusters , DistanceQuery < V > distQ ) { } } | double cost = 0 ; double [ ] dists = new double [ k ] ; for ( DBIDIter iditer = distQ . getRelation ( ) . iterDBIDs ( ) ; iditer . valid ( ) ; iditer . advance ( ) ) { // Find current cluster assignment . Ugly , but is it worth int [ n ] ?
final int current = currentCluster ( clusters , iditer ) ; int minindex = - 1 ; double mindist = Double . POSITIVE_INFINITY ; if ( current >= 0 ) { // Always prefer current assignment on ties , for convergence .
minindex = current ; mindist = dists [ current ] = distQ . distance ( iditer , miter . seek ( current ) ) ; } for ( miter . seek ( 0 ) ; miter . valid ( ) ; miter . advance ( ) ) { if ( miter . getOffset ( ) == current ) { continue ; } double d = dists [ miter . getOffset ( ) ] = distQ . distance ( iditer , miter ) ; if ( d < mindist ) { minindex = miter . getOffset ( ) ; mindist = d ; } } cost += mindist ; if ( minindex == current ) { continue ; } if ( ! clusters . get ( minindex ) . add ( iditer ) ) { throw new IllegalStateException ( "Reassigning to the same cluster. " + current + " -> " + minindex ) ; } dsum [ minindex ] += mindist ; // Remove from previous cluster
if ( current >= 0 ) { if ( ! clusters . get ( current ) . remove ( iditer ) ) { throw new IllegalStateException ( "Removing from the wrong cluster." ) ; } dsum [ current ] -= dists [ current ] ; } } return cost ; |
public class StringUtil { /** * _ 記法をキャメル記法に変換します 。
* @ param s
* テキスト
* @ return 結果の文字列 */
public static String camelize ( String s ) { } } | if ( s == null ) { return null ; } s = s . toLowerCase ( ) ; String [ ] array = StringUtil . split ( s , "_" ) ; if ( array . length == 1 ) { return StringUtil . capitalize ( s ) ; } StringBuffer buf = new StringBuffer ( 40 ) ; for ( String string : array ) { buf . append ( StringUtil . capitalize ( string ) ) ; } return buf . toString ( ) ; |
public class HttpsHealthCheckClient { /** * Retrieves the list of HttpsHealthCheck resources available to the specified project .
* < p > Sample code :
* < pre > < code >
* try ( HttpsHealthCheckClient httpsHealthCheckClient = HttpsHealthCheckClient . create ( ) ) {
* ProjectName project = ProjectName . of ( " [ PROJECT ] " ) ;
* for ( HttpsHealthCheck2 element : httpsHealthCheckClient . listHttpsHealthChecks ( project . toString ( ) ) . iterateAll ( ) ) {
* / / doThingsWith ( element ) ;
* < / code > < / pre >
* @ param project Project ID for this request .
* @ throws com . google . api . gax . rpc . ApiException if the remote call fails */
@ BetaApi public final ListHttpsHealthChecksPagedResponse listHttpsHealthChecks ( String project ) { } } | ListHttpsHealthChecksHttpRequest request = ListHttpsHealthChecksHttpRequest . newBuilder ( ) . setProject ( project ) . build ( ) ; return listHttpsHealthChecks ( request ) ; |
public class Caster { /** * cast a Object to a long value ( primitive value type )
* @ param o Object to cast
* @ return casted long value
* @ throws PageException */
public static long toLongValue ( Object o ) throws PageException { } } | if ( o instanceof Boolean ) return ( ( ( ( Boolean ) o ) . booleanValue ( ) ) ? 1L : 0L ) ; else if ( o instanceof Number ) return ( ( ( Number ) o ) . longValue ( ) ) ; else if ( o instanceof CharSequence ) { String str = o . toString ( ) ; try { return Long . parseLong ( str ) ; } catch ( NumberFormatException nfe ) { return ( long ) toDoubleValue ( str ) ; } } else if ( o instanceof Character ) return ( ( ( Character ) o ) . charValue ( ) ) ; else if ( o instanceof Castable ) return ( long ) ( ( Castable ) o ) . castToDoubleValue ( ) ; else if ( o instanceof ObjectWrap ) return toLongValue ( ( ( ObjectWrap ) o ) . getEmbededObject ( ) ) ; throw new CasterException ( o , "long" ) ; |
public class OpenFile { /** * Registers a file opener .
* @ param extensions The simple extensions , in lowercase , not including the dot , such as " dia " */
public static void addFileOpener ( ServletContext servletContext , FileOpener fileOpener , String ... extensions ) { } } | synchronized ( fileOpenersLock ) { @ SuppressWarnings ( "unchecked" ) Map < String , FileOpener > fileOpeners = ( Map < String , FileOpener > ) servletContext . getAttribute ( FILE_OPENERS_REQUEST_ATTRIBUTE_NAME ) ; if ( fileOpeners == null ) { fileOpeners = new HashMap < > ( ) ; servletContext . setAttribute ( FILE_OPENERS_REQUEST_ATTRIBUTE_NAME , fileOpeners ) ; } for ( String extension : extensions ) { if ( fileOpeners . containsKey ( extension ) ) throw new IllegalStateException ( "File opener already registered: " + extension ) ; fileOpeners . put ( extension , fileOpener ) ; } } |
public class ExecutionContextImpl { /** * As an asynchronous execution moves from the outer part to the nested inner part , update the context ' s policies */
public void setNested ( ) { } } | // If using fallback or retry , stop the timeout and restart in synchronous mode
if ( timeout != null && ( retry . getMaxRetries ( ) != 0 || fallbackPolicy != null ) ) { timeout . runSyncOnNewThread ( Thread . currentThread ( ) ) ; } int retriesRemaining = this . retry . getMaxRetries ( ) - this . retries ; if ( this . retry . getMaxDuration ( ) != null ) { long maxDuration = this . retry . getMaxDuration ( ) . toNanos ( ) ; long now = System . nanoTime ( ) ; long elapsed = now - this . startTime ; long delay = this . retry . getDelay ( ) . toNanos ( ) ; maxDuration = maxDuration - elapsed ; if ( maxDuration <= delay ) { maxDuration = delay + 1 ; retriesRemaining = 0 ; } this . retry . withMaxDuration ( maxDuration , TimeUnit . NANOSECONDS ) ; } this . retry . withMaxRetries ( retriesRemaining ) ; |
public class JFXChipViewSkin { /** * these methods are called inside the chips items change listener */
private void createChip ( T item ) { } } | JFXChip < T > chip = null ; try { if ( getSkinnable ( ) . getChipFactory ( ) != null ) { chip = getSkinnable ( ) . getChipFactory ( ) . apply ( getSkinnable ( ) , item ) ; } else { chip = new JFXDefaultChip < T > ( getSkinnable ( ) , item ) ; } } catch ( Exception e ) { throw new RuntimeException ( "can't create chip for item '" + item + "' make sure to override the string converter and return null if text input is not valid." , e ) ; } int size = root . getChildren ( ) . size ( ) ; root . getChildren ( ) . add ( size - 1 , chip ) ; |
public class Accidental { /** * Convert a string to an accidental . Understand ABC ^ and _ , chord names # ,
* b and unicode char */
public static Accidental convertToAccidental ( String accidental ) throws IllegalArgumentException { } } | if ( accidental == null ) return NONE ; else if ( accidental . equals ( "^" ) || accidental . equals ( "#" ) || accidental . equals ( "\u266F" ) ) return SHARP ; else if ( accidental . equals ( "_" ) || accidental . equals ( "b" ) || accidental . equals ( "\u266D" ) ) return FLAT ; else if ( accidental . equals ( "=" ) || accidental . equals ( "\u266E" ) ) return NATURAL ; else if ( accidental . equals ( "^^" ) || accidental . equals ( "##" ) || accidental . equals ( "\u266F\u266F" ) ) return DOUBLE_SHARP ; else if ( accidental . equals ( "__" ) || accidental . equals ( "bb" ) || accidental . equals ( "\u266D\u266D" ) ) return DOUBLE_FLAT ; else if ( accidental . equals ( "^/" ) ) return HALF_SHARP ; else if ( accidental . equals ( "_/" ) ) return HALF_FLAT ; else if ( accidental . equals ( "^3/" ) || accidental . equals ( "^3/2" ) ) return SHARP_AND_A_HALF ; else if ( accidental . equals ( "_3/" ) || accidental . equals ( "_3/2" ) ) return FLAT_AND_A_HALF ; else throw new IllegalArgumentException ( accidental + " is not a valid accidental" ) ; |
public class SqlTableTag { /** * / * ( non - Javadoc )
* @ see org . parosproxy . paros . db . paros . TableTag # getTagsForHistoryID ( long ) */
@ Override public List < RecordTag > getTagsForHistoryID ( long historyId ) throws DatabaseException { } } | SqlPreparedStatementWrapper psGetTagsForHistoryId = null ; try { psGetTagsForHistoryId = DbSQL . getSingleton ( ) . getPreparedStatement ( "tag.ps.gettagsforhid" ) ; List < RecordTag > result = new ArrayList < > ( ) ; psGetTagsForHistoryId . getPs ( ) . setLong ( 1 , historyId ) ; try ( ResultSet rs = psGetTagsForHistoryId . getPs ( ) . executeQuery ( ) ) { while ( rs . next ( ) ) { result . add ( new RecordTag ( rs . getLong ( TAGID ) , rs . getLong ( TAGID ) , rs . getString ( TAG ) ) ) ; } } return result ; } catch ( SQLException e ) { throw new DatabaseException ( e ) ; } finally { DbSQL . getSingleton ( ) . releasePreparedStatement ( psGetTagsForHistoryId ) ; } |
public class AmazonLightsailClient { /** * Gets operations for a specific resource ( e . g . , an instance or a static IP ) .
* @ param getOperationsForResourceRequest
* @ return Result of the GetOperationsForResource operation returned by the service .
* @ throws ServiceException
* A general service exception .
* @ throws InvalidInputException
* Lightsail throws this exception when user input does not conform to the validation rules of an input
* field . < / p > < note >
* Domain - related APIs are only available in the N . Virginia ( us - east - 1 ) Region . Please set your AWS Region
* configuration to us - east - 1 to create , view , or edit these resources .
* @ throws NotFoundException
* Lightsail throws this exception when it cannot find a resource .
* @ throws OperationFailureException
* Lightsail throws this exception when an operation fails to execute .
* @ throws AccessDeniedException
* Lightsail throws this exception when the user cannot be authenticated or uses invalid credentials to
* access a resource .
* @ throws AccountSetupInProgressException
* Lightsail throws this exception when an account is still in the setup in progress state .
* @ throws UnauthenticatedException
* Lightsail throws this exception when the user has not been authenticated .
* @ sample AmazonLightsail . GetOperationsForResource
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / lightsail - 2016-11-28 / GetOperationsForResource "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public GetOperationsForResourceResult getOperationsForResource ( GetOperationsForResourceRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeGetOperationsForResource ( request ) ; |
public class CharacterApi { /** * Calculate a CSPA charge cost Takes a source character ID in the url and a
* set of target character ID & # 39 ; s in the body , returns a CSPA charge cost
* - - - SSO Scope : esi - characters . read _ contacts . v1
* @ param characterId
* An EVE character ID ( required )
* @ param requestBody
* The target characters to calculate the charge for ( required )
* @ param datasource
* The server name you would like data from ( optional , default to
* tranquility )
* @ param token
* Access token to use if unable to set a header ( optional )
* @ return Float
* @ throws ApiException
* If fail to call the API , e . g . server error or cannot
* deserialize the response body */
public Float postCharactersCharacterIdCspa ( Integer characterId , List < Integer > requestBody , String datasource , String token ) throws ApiException { } } | ApiResponse < Float > resp = postCharactersCharacterIdCspaWithHttpInfo ( characterId , requestBody , datasource , token ) ; return resp . getData ( ) ; |
public class AutoIngestor { /** * For backward compatibility : assumes format METS _ EXT1_0 . uri
* @ deprecated use ingestAndCommit ( apia , apim , in , ingestFormat , logMessage )
* instead . */
@ Deprecated public static String ingestAndCommit ( FedoraAPIAMTOM apia , FedoraAPIMMTOM apim , InputStream in , String logMessage ) throws RemoteException , IOException { } } | ByteArrayOutputStream out = new ByteArrayOutputStream ( ) ; StreamUtility . pipeStream ( in , out , 4096 ) ; DataHandler handler = new DataHandler ( new ByteArrayDataSource ( out . toByteArray ( ) , "text/xml" ) ) ; String pid = apim . ingest ( handler , METS_EXT1_0 . uri , logMessage ) ; return pid ; |
public class AmazonRDSClient { /** * Returns a list of < code > DBSecurityGroup < / code > descriptions . If a < code > DBSecurityGroupName < / code > is specified ,
* the list will contain only the descriptions of the specified DB security group .
* @ param describeDBSecurityGroupsRequest
* @ return Result of the DescribeDBSecurityGroups operation returned by the service .
* @ throws DBSecurityGroupNotFoundException
* < i > DBSecurityGroupName < / i > doesn ' t refer to an existing DB security group .
* @ sample AmazonRDS . DescribeDBSecurityGroups
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / rds - 2014-10-31 / DescribeDBSecurityGroups " target = " _ top " > AWS
* API Documentation < / a > */
@ Override public DescribeDBSecurityGroupsResult describeDBSecurityGroups ( DescribeDBSecurityGroupsRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeDescribeDBSecurityGroups ( request ) ; |
public class CoreRemoteFindIterableImpl { /** * Sets a document describing the fields to return for all matching documents .
* @ param projection the project document , which may be null .
* @ return this */
public CoreRemoteFindIterableImpl < DocumentT , ResultT > projection ( @ Nullable final Bson projection ) { } } | findOptions . projection ( projection ) ; return this ; |
public class BlobReaderPageImpl { /** * Reads a buffer . */
@ Override public int read ( long pos , byte [ ] buf , int offset , int length ) { } } | if ( _fullLength <= pos ) { return - 1 ; } if ( pos < 0 ) { throw new IllegalArgumentException ( ) ; } PageBlob [ ] pages = _pages ; int i = 0 ; for ( ; i < pages . length && pages [ i ] . getLength ( ) <= pos ; i ++ ) { pos -= pages [ i ] . getLength ( ) ; } if ( pages . length <= i ) { return - 1 ; } PageBlob page = _pages [ i ] ; if ( page . getType ( ) != Type . BLOB ) { page = _pageService . getBlobPage ( page . getId ( ) ) ; pages [ i ] = page ; } /* if ( ! isValid ( ) ) {
return - 1; */
// XXX : multipage
int pageLen = page . getLength ( ) ; int pagePos = ( int ) pos ; int sublen = Math . min ( length , pageLen - pagePos ) ; int readLen = page . read ( pagePos , buf , offset , sublen ) ; if ( readLen <= 0 ) { log . warning ( "BLOB-READ UNEXPECTED EOF: " + pos + " " + _fullLength + " " + page ) ; } return readLen ; /* int sublen = _ length - _ offset ;
if ( sublen < = 0 ) {
int pid = _ blobPage . getNextId ( ) ;
if ( pid < = 0 ) {
return - 1;
_ blobPage = _ cursor . getTable ( ) . getTableService ( ) . getBlobPage ( pid ) ;
_ length = _ blobPage . getLength ( ) ;
_ offset = 0;
sublen = _ length - _ offset ;
sublen = Math . min ( sublen , length ) ;
int result = _ blobPage . read ( _ offset , buf , offset , sublen ) ;
if ( result > 0 ) {
_ offset + = result ;
return result ; */ |
public class BlockReceiver { /** * Receives and processes a packet . It can contain many chunks .
* returns size of the packet . */
private int receivePacket ( ) throws IOException { } } | eventStartReceivePacket ( ) ; long startTime = System . currentTimeMillis ( ) ; // The packet format is documented in DFSOuputStream . Packet . getBuffer ( ) .
int payloadLen = readNextPacket ( ) ; if ( payloadLen <= 0 ) { return payloadLen ; } buf . mark ( ) ; // read the header
buf . getInt ( ) ; // packet length
int packetVersion ; if ( pktIncludeVersion ) { packetVersion = buf . getInt ( ) ; } else { packetVersion = DataTransferProtocol . PACKET_VERSION_CHECKSUM_FIRST ; } offsetInBlock = buf . getLong ( ) ; // get offset of packet in block
long seqno = buf . getLong ( ) ; // get seqno
byte booleanFieldValue = buf . get ( ) ; boolean lastPacketInBlock = ( ( booleanFieldValue & DataNode . isLastPacketInBlockMask ) == 0 ) ? false : true ; boolean forceSync = ( ( booleanFieldValue & DataNode . forceSyncMask ) == 0 ) ? false : true ; int endOfHeader = buf . position ( ) ; buf . reset ( ) ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "Receiving one packet for block " + block + " of length " + payloadLen + " seqno " + seqno + " offsetInBlock " + offsetInBlock + " lastPacketInBlock " + lastPacketInBlock ) ; } eventEndReceivePacketStartForward ( ) ; // First write the packet to the mirror :
if ( mirrorOut != null && ! mirrorError ) { try { long mirrorWriteStartTime = System . currentTimeMillis ( ) ; mirrorOut . write ( buf . array ( ) , buf . position ( ) , buf . remaining ( ) ) ; mirrorOut . flush ( ) ; long mirrorWritePacketDuration = System . currentTimeMillis ( ) - mirrorWriteStartTime ; datanode . myMetrics . mirrorWritePacketLatency . inc ( mirrorWritePacketDuration ) ; if ( mirrorWritePacketDuration > slowPacketThreshold ) { LOG . info ( "operationTooSlow : mirrorPacket for block " + block + " of length " + payloadLen + " seqno " + seqno + " offsetInBlock " + offsetInBlock + " lastPacketInBlock " + lastPacketInBlock + " to mirror : " + mirrorAddr + " took : " + mirrorWritePacketDuration ) ; datanode . myMetrics . slowMirrorWritePacketNumOps . inc ( 1 ) ; } } catch ( IOException e ) { handleMirrorOutError ( e ) ; } } buf . position ( endOfHeader ) ; int len = buf . getInt ( ) ; if ( len < 0 ) { throw new IOException ( "Got wrong length during writeBlock(" + block + ") from " + inAddr + " at offset " + offsetInBlock + ": " + len ) ; } eventEndForwardStartEnqueue ( ) ; Packet ackPacket = null ; if ( responder != null ) { ackPacket = ( ( PacketResponder ) responder . getRunnable ( ) ) . enqueue ( seqno , lastPacketInBlock , offsetInBlock + len , profileForCurrentPacket ) ; } eventEndEnqueueStartSetPostion ( ) ; if ( len == 0 ) { LOG . debug ( "Receiving empty packet for block " + block ) ; } else { setBlockPosition ( offsetInBlock ) ; // adjust file position
int firstChunkOffset = ( int ) ( offsetInBlock % bytesPerChecksum ) ; long expectedBlockCrcOffset = offsetInBlock ; offsetInBlock += len ; this . replicaBeingWritten . setBytesReceived ( offsetInBlock ) ; int numChunks = ( ( firstChunkOffset + len + bytesPerChecksum - 1 ) / bytesPerChecksum ) ; if ( buf . remaining ( ) != ( numChunks * checksumSize + len ) ) { throw new IOException ( "Data remaining in packet does not match " + "sum of checksumLen and dataLen buf.remaining() " + buf . remaining ( ) + " numChunks " + numChunks + " len " + len + " offsetInBlock " + offsetInBlock ) ; } int checksumOff = buf . position ( ) ; int dataOff ; if ( packetVersion == DataTransferProtocol . PACKET_VERSION_CHECKSUM_FIRST ) { int checksumLen = numChunks * checksumSize ; dataOff = checksumOff + checksumLen ; } else if ( packetVersion == DataTransferProtocol . PACKET_VERSION_CHECKSUM_INLINE ) { dataOff = checksumOff ; } else { throw new IOException ( "Packet version " + packetVersion + " not supported." ) ; } byte pktBuf [ ] = buf . array ( ) ; buf . position ( buf . limit ( ) ) ; // move to the end of the data .
eventEndSetPositionStartVerifyChecksum ( ) ; /* skip verifying checksum iff this is not the last one in the
* pipeline and clientName is non - null . i . e . Checksum is verified
* on all the datanodes when the data is being written by a
* datanode rather than a client . Whe client is writing the data ,
* protocol includes acks and only the last datanode needs to verify
* checksum . */
if ( mirrorOut == null || clientName . length ( ) == 0 ) { verifyChunks ( pktBuf , dataOff , len , pktBuf , checksumOff , firstChunkOffset , packetVersion ) ; } eventEndVerifyChecksumStartUpdateBlockCrc ( ) ; if ( datanode . updateBlockCrcWhenWrite ) { // update Block CRC .
// It introduces extra costs in critical code path . But compared to the
// total checksum calculating costs ( the previous operation ) ,
// this costs are negligible . If we want to optimize , we can optimize it
// together with the previous operation to hide the latency from disk
// I / O latency .
int chunkOffset = ( int ) ( expectedBlockCrcOffset % bytesPerChecksum ) ; int crcCalculateOffset = checksumOff ; for ( int i = 0 ; i < numChunks ; i ++ ) { int bytesInChunk ; if ( i != numChunks - 1 ) { bytesInChunk = bytesPerChecksum - chunkOffset ; } else { bytesInChunk = ( len + chunkOffset ) % bytesPerChecksum ; if ( bytesInChunk == 0 ) { bytesInChunk = bytesPerChecksum ; } } if ( packetVersion == DataTransferProtocol . PACKET_VERSION_CHECKSUM_INLINE ) { // Needs to skip the data chunk for the checksum
crcCalculateOffset += bytesInChunk ; } replicaBeingWritten . updateBlockCrc ( expectedBlockCrcOffset , bytesInChunk , DataChecksum . getIntFromBytes ( pktBuf , crcCalculateOffset ) ) ; crcCalculateOffset += checksum . getChecksumSize ( ) ; expectedBlockCrcOffset += bytesInChunk ; chunkOffset = 0 ; } } eventEndUpdateBlockCrcStartWritePacket ( ) ; try { long writeStartTime = System . currentTimeMillis ( ) ; blockWriter . writePacket ( pktBuf , len , dataOff , checksumOff , numChunks , packetVersion ) ; datanode . myMetrics . bytesWritten . inc ( len ) ; eventEndWritePacketStartFlush ( ) ; // / flush entire packet before sending ack
this . bufSizeSinceLastSync += len ; flush ( forceSync ) ; attemptFadvise ( len ) ; if ( forceSync ) { this . bufSizeSinceLastSync = 0 ; } else if ( this . flushKb > 0 && this . bufSizeSinceLastSync >= this . flushKb * 1024 ) { long syncStartOffset = offsetInBlock - this . bufSizeSinceLastSync ; if ( syncStartOffset < 0 ) { syncStartOffset = 0 ; } long bytesToSync = offsetInBlock - syncStartOffset ; long startFileRangeSync = System . currentTimeMillis ( ) ; fileRangeSync ( bytesToSync , syncFileRange ) ; long syncFileRangeDuration = System . currentTimeMillis ( ) - startFileRangeSync ; datanode . myMetrics . syncFileRangeLatency . inc ( syncFileRangeDuration ) ; if ( syncFileRangeDuration > slowPacketThreshold ) { LOG . info ( "operationTooSlow : syncFileRange for block " + block + " of length " + payloadLen + " seqno " + seqno + " offsetInBlock " + offsetInBlock + " lastPacketInBlock " + lastPacketInBlock + " took : " + syncFileRangeDuration ) ; } this . bufSizeSinceLastSync = 0 ; } this . replicaBeingWritten . setBytesOnDisk ( offsetInBlock ) ; // Record time taken to write packet
long writePacketDuration = System . currentTimeMillis ( ) - writeStartTime ; datanode . myMetrics . writePacketLatency . inc ( writePacketDuration ) ; if ( writePacketDuration > slowPacketThreshold ) { LOG . info ( "operationTooSlow : writePacket for block " + block + " of length " + payloadLen + " seqno " + seqno + " offsetInBlock " + offsetInBlock + " lastPacketInBlock " + lastPacketInBlock + " took : " + writePacketDuration ) ; datanode . myMetrics . slowWritePacketNumOps . inc ( 1 ) ; } eventEndFlush ( ) ; } catch ( ClosedByInterruptException cix ) { LOG . warn ( "Thread interrupted when flushing bytes to disk. Might cause inconsistent sates" , cix ) ; throw cix ; } catch ( InterruptedIOException iix ) { LOG . warn ( "InterruptedIOException when flushing bytes to disk. Might cause inconsistent sates" , iix ) ; throw iix ; } catch ( IOException iex ) { datanode . checkDiskError ( iex ) ; throw iex ; } } if ( ackPacket != null ) { ackPacket . setPersistent ( ) ; } if ( throttler != null ) { // throttle I / O
throttler . throttle ( payloadLen ) ; } long receiveAndWritePacketDuration = System . currentTimeMillis ( ) - startTime ; datanode . myMetrics . receiveAndWritePacketLatency . inc ( receiveAndWritePacketDuration ) ; eventEndCurrentPacket ( ) ; return payloadLen ; |
public class TvdbParser { /** * Process the " key " from the element into an integer .
* @ param eEpisode
* @ param key
* @ return the value , 0 if not found or an error . */
private static int getEpisodeValue ( Element eEpisode , String key ) { } } | int episodeValue ; try { String value = DOMHelper . getValueFromElement ( eEpisode , key ) ; episodeValue = NumberUtils . toInt ( value , 0 ) ; } catch ( WebServiceException ex ) { LOG . trace ( "Failed to read episode value" , ex ) ; episodeValue = 0 ; } return episodeValue ; |
public class SkbShellFactory { /** * Returns a new shell with given STG and console flag .
* @ param renderer a renderer for help messages
* @ param useConsole flag to use ( true ) or not to use ( false ) console , of false then no output will happen ( except for errors on runShell ( ) and some help commands )
* @ return new shell */
public static SkbShell newShell ( MessageRenderer renderer , boolean useConsole ) { } } | return SkbShellFactory . newShell ( null , renderer , useConsole ) ; |
public class AWSDeviceFarmClient { /** * Modifies the name , description , and rules in a device pool given the attributes and the pool ARN . Rule updates
* are all - or - nothing , meaning they can only be updated as a whole ( or not at all ) .
* @ param updateDevicePoolRequest
* Represents a request to the update device pool operation .
* @ return Result of the UpdateDevicePool operation returned by the service .
* @ throws ArgumentException
* An invalid argument was specified .
* @ throws NotFoundException
* The specified entity was not found .
* @ throws LimitExceededException
* A limit was exceeded .
* @ throws ServiceAccountException
* There was a problem with the service account .
* @ sample AWSDeviceFarm . UpdateDevicePool
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / devicefarm - 2015-06-23 / UpdateDevicePool " target = " _ top " > AWS
* API Documentation < / a > */
@ Override public UpdateDevicePoolResult updateDevicePool ( UpdateDevicePoolRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeUpdateDevicePool ( request ) ; |
public class Reflector { /** * to get a Getter Method of a Object
* @ param clazz Class to invoke method from
* @ param prop Name of the Method without get
* @ return return Value of the getter Method */
public static MethodInstance getGetterEL ( Class clazz , String prop ) { } } | prop = "get" + StringUtil . ucFirst ( prop ) ; MethodInstance mi = getMethodInstanceEL ( null , clazz , KeyImpl . getInstance ( prop ) , ArrayUtil . OBJECT_EMPTY ) ; if ( mi == null ) return null ; if ( mi . getMethod ( ) . getReturnType ( ) == void . class ) return null ; return mi ; |
public class SrvCopychunk { /** * { @ inheritDoc }
* @ see jcifs . Encodable # encode ( byte [ ] , int ) */
@ Override public int encode ( byte [ ] dst , int dstIndex ) { } } | int start = dstIndex ; SMBUtil . writeInt8 ( this . sourceOffset , dst , dstIndex ) ; dstIndex += 8 ; SMBUtil . writeInt8 ( this . targetOffset , dst , dstIndex ) ; dstIndex += 8 ; SMBUtil . writeInt4 ( this . length , dst , dstIndex ) ; dstIndex += 4 ; dstIndex += 4 ; // reserved
return dstIndex - start ; |
public class AbstractPrincipalAttributesRepository { /** * Gets attribute repository .
* @ return the attribute repository */
@ JsonIgnore protected static IPersonAttributeDao getAttributeRepository ( ) { } } | val repositories = ApplicationContextProvider . getAttributeRepository ( ) ; return repositories . orElse ( null ) ; |
public class ByteArrayUtil { /** * Get a < i > long < / i > from the source byte array starting at the given offset
* in big endian order .
* There is no bounds checking .
* @ param array source byte array
* @ param offset source starting point
* @ return the < i > long < / i > */
public static long getLongBE ( final byte [ ] array , final int offset ) { } } | return ( array [ offset + 7 ] & 0XFFL ) | ( ( array [ offset + 6 ] & 0XFFL ) << 8 ) | ( ( array [ offset + 5 ] & 0XFFL ) << 16 ) | ( ( array [ offset + 4 ] & 0XFFL ) << 24 ) | ( ( array [ offset + 3 ] & 0XFFL ) << 32 ) | ( ( array [ offset + 2 ] & 0XFFL ) << 40 ) | ( ( array [ offset + 1 ] & 0XFFL ) << 48 ) | ( ( array [ offset ] & 0XFFL ) << 56 ) ; |
public class DataUrlSerializer { /** * Gets the charset that should be used to encode the { @ link DataUrl }
* @ param headers Headers map
* @ return Applied charset , never { @ code null } */
protected String getAppliedCharset ( Map < String , String > headers ) { } } | String encoding ; if ( headers != null && ( encoding = headers . get ( "charset" ) ) != null ) { return encoding ; } return "US-ASCII" ; |
public class CmsSiteDetailDialog { /** * Validates the dialog before the commit action is performed . < p >
* @ throws Exception if sth . goes wrong */
private void validateDialog ( ) throws Exception { } } | CmsResource . checkResourceName ( m_sitename ) ; m_sitename = ensureFoldername ( m_sitename ) ; if ( CmsStringUtil . isEmptyOrWhitespaceOnly ( m_site . getServer ( ) ) ) { // the server ' s URL must not be empty or null
throw new CmsException ( Messages . get ( ) . container ( Messages . ERR_SERVER_URL_NOT_EMPTY_0 ) ) ; } |
public class Gauge { /** * Sets the list of markers to the given list of Marker objects .
* The markers will be visualized using nodes with mouse event
* support ( pressed , released ) and tooltip .
* @ param MARKERS */
public void setMarkers ( final List < Marker > MARKERS ) { } } | markers . setAll ( MARKERS ) ; Collections . sort ( markers , new MarkerComparator ( ) ) ; fireUpdateEvent ( REDRAW_EVENT ) ; |
public class ServletHandler { /** * Handle request .
* @ param pathInContext
* @ param pathParams
* @ param httpRequest
* @ param httpResponse
* @ exception IOException */
public void handle ( String pathInContext , String pathParams , HttpRequest httpRequest , HttpResponse httpResponse ) throws IOException { } } | if ( ! isStarted ( ) ) return ; // Handle TRACE
if ( HttpRequest . __TRACE . equals ( httpRequest . getMethod ( ) ) ) { handleTrace ( httpRequest , httpResponse ) ; return ; } // Look for existing request / response objects ( from enterScope call )
ServletHttpRequest request = ( ServletHttpRequest ) httpRequest . getWrapper ( ) ; ServletHttpResponse response = ( ServletHttpResponse ) httpResponse . getWrapper ( ) ; if ( request == null ) { // Not in ServletHttpContext , but bumble on anyway
request = new ServletHttpRequest ( this , pathInContext , httpRequest ) ; response = new ServletHttpResponse ( request , httpResponse ) ; httpRequest . setWrapper ( request ) ; httpResponse . setWrapper ( response ) ; } else { request . recycle ( this , pathInContext ) ; response . recycle ( ) ; } // Look for the servlet
Map . Entry servlet = getHolderEntry ( pathInContext ) ; ServletHolder servletHolder = servlet == null ? null : ( ServletHolder ) servlet . getValue ( ) ; if ( log . isDebugEnabled ( ) ) log . debug ( "servlet=" + servlet ) ; try { // Adjust request paths
if ( servlet != null ) { String servletPathSpec = ( String ) servlet . getKey ( ) ; request . setServletPaths ( PathMap . pathMatch ( servletPathSpec , pathInContext ) , PathMap . pathInfo ( servletPathSpec , pathInContext ) , servletHolder ) ; } // Handle the session ID
request . setRequestedSessionId ( pathParams ) ; HttpSession session = request . getSession ( false ) ; if ( session != null ) ( ( SessionManager . Session ) session ) . access ( ) ; if ( log . isDebugEnabled ( ) ) log . debug ( "session=" + session ) ; // Do that funky filter and servlet thang !
if ( servletHolder != null ) dispatch ( pathInContext , request , response , servletHolder , Dispatcher . __REQUEST ) ; } catch ( Exception e ) { log . debug ( LogSupport . EXCEPTION , e ) ; Throwable th = e ; while ( th instanceof ServletException ) { log . warn ( LogSupport . EXCEPTION , th ) ; Throwable cause = ( ( ServletException ) th ) . getRootCause ( ) ; if ( cause == th || cause == null ) break ; th = cause ; } if ( th instanceof HttpException ) throw ( HttpException ) th ; if ( th instanceof EOFException ) throw ( IOException ) th ; else if ( log . isDebugEnabled ( ) || ! ( th instanceof java . io . IOException ) ) { if ( _contextLog != null ) { if ( th instanceof RuntimeException ) _contextLog . error ( httpRequest . getURI ( ) + ": " , th ) ; else _contextLog . warn ( httpRequest . getURI ( ) + ": " , th ) ; } if ( log . isDebugEnabled ( ) ) { if ( th instanceof RuntimeException ) log . error ( httpRequest . getURI ( ) + ": " , th ) ; else log . warn ( httpRequest . getURI ( ) + ": " , th ) ; log . debug ( httpRequest ) ; } } httpResponse . getHttpConnection ( ) . forceClose ( ) ; if ( ! httpResponse . isCommitted ( ) ) { request . setAttribute ( ServletHandler . __J_S_ERROR_EXCEPTION_TYPE , th . getClass ( ) ) ; request . setAttribute ( ServletHandler . __J_S_ERROR_EXCEPTION , th ) ; if ( th instanceof UnavailableException ) { UnavailableException ue = ( UnavailableException ) th ; if ( ue . isPermanent ( ) ) response . sendError ( HttpResponse . __404_Not_Found , e . getMessage ( ) ) ; else response . sendError ( HttpResponse . __503_Service_Unavailable , e . getMessage ( ) ) ; } else response . sendError ( HttpResponse . __500_Internal_Server_Error , e . getMessage ( ) ) ; } else if ( log . isDebugEnabled ( ) ) log . debug ( "Response already committed for handling " + th ) ; } catch ( Error e ) { log . warn ( "Error for " + httpRequest . getURI ( ) , e ) ; if ( log . isDebugEnabled ( ) ) log . debug ( httpRequest ) ; httpResponse . getHttpConnection ( ) . forceClose ( ) ; if ( ! httpResponse . isCommitted ( ) ) { request . setAttribute ( ServletHandler . __J_S_ERROR_EXCEPTION_TYPE , e . getClass ( ) ) ; request . setAttribute ( ServletHandler . __J_S_ERROR_EXCEPTION , e ) ; response . sendError ( HttpResponse . __500_Internal_Server_Error , e . getMessage ( ) ) ; } else if ( log . isDebugEnabled ( ) ) log . debug ( "Response already committed for handling " , e ) ; } finally { if ( servletHolder != null && response != null ) { response . complete ( ) ; } } |
public class SchemaTableTree { /** * calculate property restrictions from explicit restrictions and required properties */
private void calculatePropertyRestrictions ( ) { } } | if ( restrictedProperties == null ) { return ; } // we use aliases for ordering , so we need the property in the select clause
for ( org . javatuples . Pair < Traversal . Admin < ? , ? > , Comparator < ? > > comparator : this . getDbComparators ( ) ) { if ( comparator . getValue1 ( ) instanceof ElementValueComparator ) { restrictedProperties . add ( ( ( ElementValueComparator < ? > ) comparator . getValue1 ( ) ) . getPropertyKey ( ) ) ; } else if ( ( comparator . getValue0 ( ) instanceof ElementValueTraversal < ? > || comparator . getValue0 ( ) instanceof TokenTraversal < ? , ? > ) && comparator . getValue1 ( ) instanceof Order ) { Traversal . Admin < ? , ? > t = comparator . getValue0 ( ) ; String key ; if ( t instanceof ElementValueTraversal ) { ElementValueTraversal < ? > elementValueTraversal = ( ElementValueTraversal < ? > ) t ; key = elementValueTraversal . getPropertyKey ( ) ; } else { TokenTraversal < ? , ? > tokenTraversal = ( TokenTraversal < ? , ? > ) t ; // see calculateLabeledAliasId
if ( tokenTraversal . getToken ( ) . equals ( T . id ) ) { key = Topology . ID ; } else { key = tokenTraversal . getToken ( ) . getAccessor ( ) ; } } if ( key != null ) { restrictedProperties . add ( key ) ; } } } |
public class AbstractRemoteSupport { /** * Method to indicate that the destination has been deleted */
public void setToBeDeleted ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "setToBeDeleted" ) ; synchronized ( _anycastInputHandlers ) { _toBeDeleted = true ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "setToBeDeleted" ) ; |
public class AbstractPlugin { /** * Processes languages . Retrieves language labels with default locale , then sets them into the specified data model .
* @ param dataModel the specified data model */
private void handleLangs ( final Map < String , Object > dataModel ) { } } | final Locale locale = Latkes . getLocale ( ) ; final String language = locale . getLanguage ( ) ; final String country = locale . getCountry ( ) ; final String variant = locale . getVariant ( ) ; final StringBuilder keyBuilder = new StringBuilder ( language ) ; if ( StringUtils . isNotBlank ( country ) ) { keyBuilder . append ( "_" ) . append ( country ) ; } if ( StringUtils . isNotBlank ( variant ) ) { keyBuilder . append ( "_" ) . append ( variant ) ; } final String localKey = keyBuilder . toString ( ) ; final Properties props = langs . get ( localKey ) ; if ( null == props ) { return ; } final Set < Object > keySet = props . keySet ( ) ; for ( final Object key : keySet ) { dataModel . put ( ( String ) key , props . getProperty ( ( String ) key ) ) ; } |
public class CsvBindingErrors { /** * グローバルエラーを登録する 。
* @ since 2.2
* @ param errorCodes エラーコード
* @ param messageVariables メッセージ中の変数 。
* @ param defaultMessage 指定したエラーコードに対するメッセージが見つからないときに使用するメッセージです 。 指定しない場合はnullを設定します 。 */
public void reject ( final String [ ] errorCodes , final Map < String , Object > messageVariables , final String defaultMessage ) { } } | String [ ] codes = new String [ 0 ] ; for ( String errorCode : errorCodes ) { codes = Utils . concat ( codes , messageCodeGenerator . generateCodes ( errorCode , getObjectName ( ) ) ) ; } addError ( new CsvError ( getObjectName ( ) , codes , messageVariables , defaultMessage ) ) ; |
public class SARLValidator { /** * Check if implemented interfaces of a Xtend Class are redundant .
* @ param xtendClass the class . */
@ Check public void checkRedundantImplementedInterfaces ( SarlClass xtendClass ) { } } | checkRedundantInterfaces ( xtendClass , XTEND_CLASS__IMPLEMENTS , xtendClass . getImplements ( ) , Utils . singletonList ( xtendClass . getExtends ( ) ) ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.