signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class GenericsUtils { /** * Given a parameterized type and a generic type information , aligns actual type parameters . For example , if a
* class uses generic type < pre > & lt ; T , U , V & gt ; < / pre > ( redirectGenericTypes ) , is used with actual type parameters
* < pre > & lt ; java . lang . String , U , V & gt ; < / pre > , then a class or interface using generic types < pre > & lt ; T , V & gt ; < / pre >
* will be aligned to < pre > & lt ; java . lang . String , V & gt ; < / pre >
* @ param redirectGenericTypes the type arguments or the redirect class node
* @ param parameterizedTypes the actual type arguments used on this class node
* @ param alignmentTarget the generic type arguments to which we want to align to
* @ return aligned type arguments
* @ deprecated You shouldn ' t call this method because it is inherently unreliable */
@ Deprecated public static GenericsType [ ] alignGenericTypes ( final GenericsType [ ] redirectGenericTypes , final GenericsType [ ] parameterizedTypes , final GenericsType [ ] alignmentTarget ) { } } | if ( alignmentTarget == null ) return EMPTY_GENERICS_ARRAY ; if ( parameterizedTypes == null || parameterizedTypes . length == 0 ) return alignmentTarget ; GenericsType [ ] generics = new GenericsType [ alignmentTarget . length ] ; for ( int i = 0 , scgtLength = alignmentTarget . length ; i < scgtLength ; i ++ ) { final GenericsType currentTarget = alignmentTarget [ i ] ; GenericsType match = null ; if ( redirectGenericTypes != null ) { for ( int j = 0 ; j < redirectGenericTypes . length && match == null ; j ++ ) { GenericsType redirectGenericType = redirectGenericTypes [ j ] ; if ( redirectGenericType . isCompatibleWith ( currentTarget . getType ( ) ) ) { if ( currentTarget . isPlaceholder ( ) && redirectGenericType . isPlaceholder ( ) && ! currentTarget . getName ( ) . equals ( redirectGenericType . getName ( ) ) ) { // check if there ' s a potential better match
boolean skip = false ; for ( int k = j + 1 ; k < redirectGenericTypes . length && ! skip ; k ++ ) { GenericsType ogt = redirectGenericTypes [ k ] ; if ( ogt . isPlaceholder ( ) && ogt . isCompatibleWith ( currentTarget . getType ( ) ) && ogt . getName ( ) . equals ( currentTarget . getName ( ) ) ) { skip = true ; } } if ( skip ) continue ; } match = parameterizedTypes [ j ] ; if ( currentTarget . isWildcard ( ) ) { // if alignment target is a wildcard type
// then we must make best effort to return a parameterized
// wildcard
ClassNode lower = currentTarget . getLowerBound ( ) != null ? match . getType ( ) : null ; ClassNode [ ] currentUpper = currentTarget . getUpperBounds ( ) ; ClassNode [ ] upper = currentUpper != null ? new ClassNode [ currentUpper . length ] : null ; if ( upper != null ) { for ( int k = 0 ; k < upper . length ; k ++ ) { upper [ k ] = currentUpper [ k ] . isGenericsPlaceHolder ( ) ? match . getType ( ) : currentUpper [ k ] ; } } match = new GenericsType ( ClassHelper . makeWithoutCaching ( "?" ) , upper , lower ) ; match . setWildcard ( true ) ; } } } } if ( match == null ) { match = currentTarget ; } generics [ i ] = match ; } return generics ; |
public class A_CmsUpdateDBPart { /** * Loads a Java properties hash containing SQL queries . < p >
* @ param propertyFilename the package / filename of the properties hash
* @ throws IOException if the sql queries property file could not be read */
protected void loadQueryProperties ( String propertyFilename ) throws IOException { } } | Properties properties = new Properties ( ) ; properties . load ( getClass ( ) . getClassLoader ( ) . getResourceAsStream ( propertyFilename ) ) ; @ SuppressWarnings ( "unchecked" ) Enumeration < String > propertyNames = ( Enumeration < String > ) properties . propertyNames ( ) ; while ( propertyNames . hasMoreElements ( ) ) { String propertyName = propertyNames . nextElement ( ) ; m_queries . put ( propertyName , properties . getProperty ( propertyName ) ) ; } |
public class HColumnImpl { /** * Clear value , timestamp and ttl ( the latter two set to ' 0 ' ) leaving only the column name */
@ Override public HColumn < N , V > clear ( ) { } } | column . value = null ; column . timestamp = 0 ; column . ttl = 0 ; column . setTimestampIsSet ( false ) ; column . setTtlIsSet ( false ) ; column . setValueIsSet ( false ) ; return this ; |
public class TransferQuotaPolicy { /** * Called to send a ' quota exceeded ' failure .
* @ param context
* @ param config
* @ param chain
* @ param rtr */
protected void doQuotaExceededFailure ( final IPolicyContext context , final TransferQuotaConfig config , final IPolicyChain < ? > chain , RateLimitResponse rtr ) { } } | Map < String , String > responseHeaders = RateLimitingPolicy . responseHeaders ( config , rtr , defaultLimitHeader ( ) , defaultRemainingHeader ( ) , defaultResetHeader ( ) ) ; IPolicyFailureFactoryComponent failureFactory = context . getComponent ( IPolicyFailureFactoryComponent . class ) ; PolicyFailure failure = limitExceededFailure ( failureFactory ) ; failure . getHeaders ( ) . putAll ( responseHeaders ) ; chain . doFailure ( failure ) ; |
public class GeneratedDFactoryDaoImpl { /** * query - by method for field clientId
* @ param clientId the specified attribute
* @ return an Iterable of DFactorys for the specified clientId */
public Iterable < DFactory > queryByClientId ( java . lang . String clientId ) { } } | return queryByField ( null , DFactoryMapper . Field . CLIENTID . getFieldName ( ) , clientId ) ; |
public class ManagedApplication { /** * Acknowledges a heart beat .
* @ param scopedInstance a root instance */
public void acknowledgeHeartBeat ( Instance scopedInstance ) { } } | String count = scopedInstance . data . get ( MISSED_HEARTBEATS ) ; if ( count != null && Integer . parseInt ( count ) > THRESHOLD ) this . logger . info ( "Agent " + InstanceHelpers . computeInstancePath ( scopedInstance ) + " is alive and reachable again." ) ; // Store the moment the first ACK ( without interruption ) was received .
// If we were deploying , store it .
// If we were in problem , store it .
// If we were already deployed and started , do NOT override it .
if ( scopedInstance . getStatus ( ) != InstanceStatus . DEPLOYED_STARTED || ! scopedInstance . data . containsKey ( Instance . RUNNING_FROM ) ) scopedInstance . data . put ( Instance . RUNNING_FROM , String . valueOf ( new Date ( ) . getTime ( ) ) ) ; scopedInstance . setStatus ( InstanceStatus . DEPLOYED_STARTED ) ; scopedInstance . data . remove ( MISSED_HEARTBEATS ) ; |
public class AbstractTriangle3F { /** * Replies if the triangle intersects the capsule .
* @ param tx1 x coordinate of the first point of the triangle .
* @ param ty1 y coordinate of the first point of the triangle .
* @ param tz1 z coordinate of the first point of the triangle .
* @ param tx2 x coordinate of the second point of the triangle .
* @ param ty2 y coordinate of the second point of the triangle .
* @ param tz2 z coordinate of the second point of the triangle .
* @ param tx3 x coordinate of the third point of the triangle .
* @ param ty3 y coordinate of the third point of the triangle .
* @ param tz3 z coordinate of the third point of the triangle .
* @ param cx1 x coordinate of the first point of the capsule medial .
* @ param cy1 y coordinate of the first point of the capsule medial .
* @ param cz1 z coordinate of the first point of the capsule medial .
* @ param cx2 x coordinate of the second point of the capsule medial .
* @ param cy2 y coordinate of the second point of the capsule medial .
* @ param cz2 z coordinate of the second point of the capsule medial .
* @ param radius radius of the capsule .
* @ return < code > true < / code > if the triangle and capsule are intersecting .
* @ see " https : / / github . com / juj / MathGeoLib " */
@ Pure @ Unefficient public static boolean intersectsTriangleCapsule ( double tx1 , double ty1 , double tz1 , double tx2 , double ty2 , double tz2 , double tx3 , double ty3 , double tz3 , double cx1 , double cy1 , double cz1 , double cx2 , double cy2 , double cz2 , double radius ) { } } | double d = distanceSquaredTriangleSegment ( tx1 , ty1 , tz1 , tx2 , ty2 , tz2 , tx3 , ty3 , tz3 , cx1 , cy1 , cz1 , cx2 , cy2 , cz2 ) ; return d < ( radius * radius ) ; |
public class EventLogger { /** * Logs events with a level of ALL .
* @ param msg The event StructuredDataMessage . */
public static void logEvent ( final StructuredDataMessage msg ) { } } | LOGGER . logIfEnabled ( FQCN , Level . OFF , EVENT_MARKER , msg , null ) ; |
public class Cluster { /** * A list of nodes that are currently in the cluster .
* @ param nodes
* A list of nodes that are currently in the cluster . */
public void setNodes ( java . util . Collection < Node > nodes ) { } } | if ( nodes == null ) { this . nodes = null ; return ; } this . nodes = new java . util . ArrayList < Node > ( nodes ) ; |
public class StatefulBeanO { /** * Destroy but do not remove this < code > BeanO < / code > instance . This
* method must be used instead of the destroy method when a uncheck
* or system exception occurs to ensure no lifecycle callback
* ( e . g . ejbRemove or pre - destroy interceptor method ) method is
* invoked as required by the EJB spec . < p >
* This method must be called whenever this BeanO instance is no
* longer valid . It transitions the BeanO to the DESTROYED state ,
* transitions the associated session bean ( if any ) to the
* does not exist state , and releases the reference to the
* associated session bean . < p >
* It however does not remove the Session Bean as done by destroy */
public final synchronized void destroyNotRemove ( ) { } } | final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) // d144064
Tr . entry ( tc , "destroyNotRemove : " + this ) ; if ( state == DESTROYED ) { return ; } // If running in an extended persistence context , the JEERuntime code
// maintains a map of SFSBs that must be cleaned up . This is
// especially important if this method is called due to a timeout .
// PM12927
if ( ivExPcContext != null ) { container . getEJBRuntime ( ) . getEJBJPAContainer ( ) . onRemoveOrDiscard ( ivExPcContext ) ; } if ( isZOS ) { removeServantRoutingAffinity ( ) ; // d646413.2
} setState ( DESTROYED ) ; // Release any JCDI creational contexts that may exist . F743-29174
releaseManagedObjectContext ( ) ; if ( pmiBean != null ) { pmiBean . beanDestroyed ( ) ; } disconnectWrapper ( ) ; // F61004.6
destroyHandleList ( ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) // d144064
Tr . exit ( tc , "destroyNotRemove" ) ; |
public class LockedInodePath { /** * Locks a descendant of the current path and returns a new locked inode path . The path is
* traversed according to the lock pattern . Closing the new path will have no effect on the
* current path .
* On failure , all locks taken by this method will be released .
* @ param descendantUri the full descendent uri starting from the root
* @ param lockPattern the lock pattern to lock in
* @ return the new locked path */
public LockedInodePath lockDescendant ( AlluxioURI descendantUri , LockPattern lockPattern ) throws InvalidPathException { } } | LockedInodePath path = new LockedInodePath ( descendantUri , this , PathUtils . getPathComponents ( descendantUri . getPath ( ) ) , lockPattern ) ; path . traverseOrClose ( ) ; return path ; |
public class MP3FileID3Controller { /** * A short description like winamp does in its default
* @ since 26.12.2008
* @ return */
public String getShortDescription ( ) { } } | String artist = null ; String album = null ; String title = null ; if ( id3v2Exists ( ) ) { artist = getArtist ( ID3V2 ) ; title = getTitle ( ID3V2 ) ; album = getAlbum ( ID3V2 ) ; } if ( id3v1Exists ( ) ) { if ( artist == null || artist . length ( ) == 0 ) artist = getArtist ( ID3V1 ) ; if ( title == null || title . length ( ) == 0 ) title = getTitle ( ID3V1 ) ; if ( album == null || album . length ( ) == 0 ) album = getAlbum ( ID3V1 ) ; } StringBuilder str = new StringBuilder ( ) ; if ( artist != null && artist . length ( ) != 0 ) { str . append ( artist ) . append ( " - " ) ; } if ( album != null && album . length ( ) != 0 ) { str . append ( album ) . append ( " - " ) ; } if ( title == null || title . length ( ) == 0 ) title = MultimediaContainerManager . getSongNameFromFile ( mp3File ) ; return str . append ( title ) . toString ( ) ; |
public class UserAttrs { /** * Returns user - defined - attribute - 1 if not found .
* @ param path
* @ param attribute
* @ param options
* @ return
* @ throws IOException */
public static final short getShortAttribute ( Path path , String attribute , LinkOption ... options ) throws IOException { } } | return getShortAttribute ( path , attribute , ( short ) - 1 , options ) ; |
public class ResourceGroovyMethods { /** * Recursively processes each descendant subdirectory in this directory .
* Processing consists of calling < code > closure < / code > passing it the current
* subdirectory and then recursively processing that subdirectory .
* Regular files are ignored during traversal .
* @ param self a File ( that happens to be a folder / directory )
* @ param closure a closure
* @ throws FileNotFoundException if the given directory does not exist
* @ throws IllegalArgumentException if the provided File object does not represent a directory
* @ see # eachFileRecurse ( java . io . File , groovy . io . FileType , groovy . lang . Closure )
* @ since 1.5.0 */
public static void eachDirRecurse ( final File self , @ ClosureParams ( value = SimpleType . class , options = "java.io.File" ) final Closure closure ) throws FileNotFoundException , IllegalArgumentException { } } | eachFileRecurse ( self , FileType . DIRECTORIES , closure ) ; |
public class MessageFormat { /** * < strong > [ icu ] < / strong > Sets the Format objects to use for the values passed into
* < code > format < / code > methods or returned from < code > parse < / code >
* methods . The keys in < code > newFormats < / code > are the argument
* names in the previously set pattern string , and the values
* are the formats .
* Only argument names from the pattern string are considered .
* Extra keys in < code > newFormats < / code > that do not correspond
* to an argument name are ignored . Similarly , if there is no
* format in newFormats for an argument name , the formatter
* for that argument remains unchanged .
* This may be called on formats that do not use named arguments .
* In this case the map will be queried for key Strings that
* represent argument indices , e . g . " 0 " , " 1 " , " 2 " etc .
* @ param newFormats a map from String to Format providing new
* formats for named arguments . */
public void setFormatsByArgumentName ( Map < String , Format > newFormats ) { } } | for ( int partIndex = 0 ; ( partIndex = nextTopLevelArgStart ( partIndex ) ) >= 0 ; ) { String key = getArgName ( partIndex + 1 ) ; if ( newFormats . containsKey ( key ) ) { setCustomArgStartFormat ( partIndex , newFormats . get ( key ) ) ; } } |
public class MsWordUtils { /** * 获取一个XWPFRun对象
* @ param paragraphIndex XWPFParagraph位置
* @ param runIndex XWPFRun位置
* @ return { @ link XWPFRun } */
public static XWPFRun getRun ( int paragraphIndex , int runIndex ) { } } | createXwpfDocumentIfNull ( ) ; return xwpfDocument . getParagraphs ( ) . get ( paragraphIndex ) . getRuns ( ) . get ( runIndex ) ; |
public class P0_JdbcTemplateOp { /** * 使用jdbcTemplate模版执行update , 不支持in ( ? ) 表达式
* @ param sql
* @ param args
* @ return 实际修改的行数 */
protected int jdbcExecuteUpdate ( String sql , Object ... args ) { } } | log ( sql ) ; long start = System . currentTimeMillis ( ) ; int rows = jdbcTemplate . update ( sql . toString ( ) , args ) ; // 此处可以用jdbcTemplate , 因为没有in ( ? ) 表达式
long cost = System . currentTimeMillis ( ) - start ; logSlow ( cost , sql , args == null ? new ArrayList < Object > ( ) : Arrays . asList ( args ) ) ; return rows ; |
public class ShadedNettyChannelFactory { /** * Converts the given negotiation type to netty ' s negotiation type .
* @ param negotiationType The negotiation type to convert .
* @ return The converted negotiation type . */
protected static io . grpc . netty . shaded . io . grpc . netty . NegotiationType of ( final NegotiationType negotiationType ) { } } | switch ( negotiationType ) { case PLAINTEXT : return io . grpc . netty . shaded . io . grpc . netty . NegotiationType . PLAINTEXT ; case PLAINTEXT_UPGRADE : return io . grpc . netty . shaded . io . grpc . netty . NegotiationType . PLAINTEXT_UPGRADE ; case TLS : return io . grpc . netty . shaded . io . grpc . netty . NegotiationType . TLS ; default : throw new IllegalArgumentException ( "Unsupported NegotiationType: " + negotiationType ) ; } |
public class BoundedLocalCache { /** * Expires entries on the write - order queue . */
@ GuardedBy ( "evictionLock" ) void expireAfterWriteEntries ( long now ) { } } | if ( ! expiresAfterWrite ( ) ) { return ; } long duration = expiresAfterWriteNanos ( ) ; for ( ; ; ) { final Node < K , V > node = writeOrderDeque ( ) . peekFirst ( ) ; if ( ( node == null ) || ( ( now - node . getWriteTime ( ) ) < duration ) ) { break ; } evictEntry ( node , RemovalCause . EXPIRED , now ) ; } |
public class CodedConstant { /** * Read a field of any primitive type for immutable messages from a CodedInputStream . Enums , groups , and embedded
* messages are not handled by this method .
* @ param input The stream from which to read .
* @ param type Declared type of the field .
* @ param checkUtf8 When true , check that the input is valid utf8.
* @ return An object representing the field ' s value , of the exact type which would be returned by
* { @ link Message # getField ( Descriptors . FieldDescriptor ) } for this field .
* @ throws IOException Signals that an I / O exception has occurred . */
public static Object readPrimitiveField ( CodedInputStream input , final WireFormat . FieldType type , boolean checkUtf8 ) throws IOException { } } | switch ( type ) { case DOUBLE : return input . readDouble ( ) ; case FLOAT : return input . readFloat ( ) ; case INT64 : return input . readInt64 ( ) ; case UINT64 : return input . readUInt64 ( ) ; case INT32 : return input . readInt32 ( ) ; case FIXED64 : return input . readFixed64 ( ) ; case FIXED32 : return input . readFixed32 ( ) ; case BOOL : return input . readBool ( ) ; case STRING : if ( checkUtf8 ) { return input . readStringRequireUtf8 ( ) ; } else { return input . readString ( ) ; } case BYTES : return input . readBytes ( ) ; case UINT32 : return input . readUInt32 ( ) ; case SFIXED32 : return input . readSFixed32 ( ) ; case SFIXED64 : return input . readSFixed64 ( ) ; case SINT32 : return input . readSInt32 ( ) ; case SINT64 : return input . readSInt64 ( ) ; case GROUP : throw new IllegalArgumentException ( "readPrimitiveField() cannot handle nested groups." ) ; case MESSAGE : throw new IllegalArgumentException ( "readPrimitiveField() cannot handle embedded messages." ) ; case ENUM : // We don ' t handle enums because we don ' t know what to do if the
// value is not recognized .
throw new IllegalArgumentException ( "readPrimitiveField() cannot handle enums." ) ; } throw new RuntimeException ( "There is no way to get here, but the compiler thinks otherwise." ) ; |
public class Output { /** * { @ inheritDoc } */
@ Override public void writeByteArray ( ByteArray array ) { } } | writeAMF3 ( ) ; buf . put ( AMF3 . TYPE_BYTEARRAY ) ; if ( hasReference ( array ) ) { putInteger ( getReferenceId ( array ) << 1 ) ; return ; } storeReference ( array ) ; IoBuffer data = array . getData ( ) ; putInteger ( data . limit ( ) << 1 | 1 ) ; byte [ ] tmp = new byte [ data . limit ( ) ] ; int old = data . position ( ) ; try { data . position ( 0 ) ; data . get ( tmp ) ; buf . put ( tmp ) ; } finally { data . position ( old ) ; } |
public class ChartistJSFApplicationFactory { /** * If the given application not an instance of { @ link ChartistJSFApplication } , nor wraps the { @ link ChartistJSFApplication } , then
* it will be wrapped by a new instance of { @ link ChartistJSFApplication } and set as the current instance and returned .
* Additionally , it will check if all Application implementations properly extend from ApplicationWrapper . */
private synchronized Application createChartistJSFApplication ( final Application application ) { } } | Application newApplication = application ; while ( ! ( newApplication instanceof ChartistJSFApplication ) && newApplication instanceof ApplicationWrapper ) { newApplication = ( ( ApplicationWrapper ) newApplication ) . getWrapped ( ) ; } if ( ! ( newApplication instanceof ChartistJSFApplication ) ) { newApplication = new ChartistJSFApplication ( application ) ; } this . application = newApplication ; return this . application ; |
public class FilterQuery { /** * Alternative to filter , which accepts a range of items to filter .
* For instance , the field might be a year , and minValue 2000 and maxValue 2009
* this filter will return records between the supplied ranges ( inclusive )
* @ param field
* @ param minValue
* @ param maxValue */
public < T > void addRangeFilter ( String field , T minValue , T maxValue ) { } } | if ( minValue instanceof String ) { if ( StringUtils . isEmpty ( field ) || StringUtils . isEmpty ( ( String ) minValue ) || StringUtils . isEmpty ( ( String ) maxValue ) ) { throw new IllegalArgumentException ( "Expected all attributes to be non empty" ) ; } filterQueries . put ( field , new FilterFieldRange ( field , ( String ) minValue , ( String ) maxValue ) ) ; } else if ( minValue instanceof Date ) { filterQueries . put ( field , new FilterFieldRangeDate ( field , ( Date ) minValue , ( Date ) maxValue ) ) ; } else if ( minValue instanceof Integer ) { filterQueries . put ( field , new FilterFieldRange . FilterFieldRangeInteger ( field , ( Integer ) minValue , ( Integer ) maxValue ) ) ; } |
public class CacheEventListenerConfigurationBuilder { /** * Adds specific { @ link EventFiring } to the returned builder .
* < ul >
* < li > { @ link EventFiring } defaults to { @ link EventFiring # ASYNCHRONOUS } < / li >
* < / ul >
* @ param eventFiringMode the { @ code EventFiring } to use
* @ return a new builder with the specified event firing
* @ see # synchronous ( )
* @ see # asynchronous ( ) */
public CacheEventListenerConfigurationBuilder firingMode ( EventFiring eventFiringMode ) { } } | CacheEventListenerConfigurationBuilder otherBuilder = new CacheEventListenerConfigurationBuilder ( this ) ; otherBuilder . eventFiringMode = eventFiringMode ; return otherBuilder ; |
public class UserLog { /** * Set up the screen input fields . */
public void setupFields ( ) { } } | FieldInfo field = null ; field = new FieldInfo ( this , ID , Constants . DEFAULT_FIELD_LENGTH , null , null ) ; field . setDataClass ( Integer . class ) ; field . setHidden ( true ) ; field = new FieldInfo ( this , LAST_CHANGED , Constants . DEFAULT_FIELD_LENGTH , null , null ) ; field . setDataClass ( Date . class ) ; field . setHidden ( true ) ; field = new FieldInfo ( this , DELETED , 10 , null , new Boolean ( false ) ) ; field . setDataClass ( Boolean . class ) ; field . setHidden ( true ) ; field = new FieldInfo ( this , USER_ID , Constants . DEFAULT_FIELD_LENGTH , null , null ) ; field . setDataClass ( Integer . class ) ; field = new FieldInfo ( this , LOG_TIME , 25 , null , null ) ; field . setDataClass ( Date . class ) ; field = new FieldInfo ( this , MESSAGE , 127 , null , null ) ; field = new FieldInfo ( this , USER_LOG_TYPE_ID , Constants . DEFAULT_FIELD_LENGTH , null , null ) ; field . setDataClass ( Integer . class ) ; |
public class AttributeValueMarshaller { /** * Marshall the given parameter object . */
public void marshall ( AttributeValue attributeValue , ProtocolMarshaller protocolMarshaller ) { } } | if ( attributeValue == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( attributeValue . getValue ( ) , VALUE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class ObjectInputStream { /** * Read a string encoded in { @ link DataInput modified UTF - 8 } from the
* receiver . Return the string read .
* @ param unshared
* read the object unshared
* @ return the string just read .
* @ throws IOException
* If an IO exception happened when reading the String . */
private Object readNewString ( boolean unshared ) throws IOException { } } | Object result = input . readUTF ( ) ; if ( enableResolve ) { result = resolveObject ( result ) ; } registerObjectRead ( result , nextHandle ( ) , unshared ) ; return result ; |
public class ExamplePnP { /** * Generates synthetic observations randomly in front of the camera . Observations are in normalized image
* coordinates and not pixels ! See { @ link PerspectiveOps # convertPixelToNorm } for how to go from pixels
* to normalized image coordinates . */
public List < Point2D3D > createObservations ( Se3_F64 worldToCamera , int total ) { } } | Se3_F64 cameraToWorld = worldToCamera . invert ( null ) ; // transform from pixel coordinates to normalized pixel coordinates , which removes lens distortion
Point2Transform2_F64 pixelToNorm = LensDistortionFactory . narrow ( intrinsic ) . undistort_F64 ( true , false ) ; List < Point2D3D > observations = new ArrayList < > ( ) ; Point2D_F64 norm = new Point2D_F64 ( ) ; for ( int i = 0 ; i < total ; i ++ ) { // randomly pixel a point inside the image
double x = rand . nextDouble ( ) * intrinsic . width ; double y = rand . nextDouble ( ) * intrinsic . height ; // Convert to normalized image coordinates because that ' s what PNP needs .
// it can ' t process pixel coordinates
pixelToNorm . compute ( x , y , norm ) ; // Randomly pick a depth and compute 3D coordinate
double Z = rand . nextDouble ( ) + 4 ; double X = norm . x * Z ; double Y = norm . y * Z ; // Change the point ' s reference frame from camera to world
Point3D_F64 cameraPt = new Point3D_F64 ( X , Y , Z ) ; Point3D_F64 worldPt = new Point3D_F64 ( ) ; SePointOps_F64 . transform ( cameraToWorld , cameraPt , worldPt ) ; // Save the perfect noise free observation
Point2D3D o = new Point2D3D ( ) ; o . getLocation ( ) . set ( worldPt ) ; o . getObservation ( ) . set ( norm . x , norm . y ) ; observations . add ( o ) ; } return observations ; |
public class SqlTransientExceptionDetector { /** * Determines if the SQL exception is a connection exception
* @ param se the exception
* @ return true if it is a code 08nnn , otherwise false */
public static boolean isSqlStateConnectionException ( SQLException se ) { } } | String sqlState = se . getSQLState ( ) ; return sqlState != null && sqlState . startsWith ( "08" ) ; |
public class StoredPaymentChannelClientStates { /** * If the peer group has not been set for MAX _ SECONDS _ TO _ WAIT _ FOR _ BROADCASTER _ TO _ BE _ SET seconds , then
* the programmer probably forgot to set it and we should throw exception . */
private TransactionBroadcaster getAnnouncePeerGroup ( ) { } } | try { return announcePeerGroupFuture . get ( MAX_SECONDS_TO_WAIT_FOR_BROADCASTER_TO_BE_SET , TimeUnit . SECONDS ) ; } catch ( InterruptedException e ) { throw new RuntimeException ( e ) ; } catch ( ExecutionException e ) { throw new RuntimeException ( e ) ; } catch ( TimeoutException e ) { String err = "Transaction broadcaster not set" ; log . error ( err ) ; throw new RuntimeException ( err , e ) ; } |
public class DatabaseDAODefaultImpl { public void deleteAllDevicePipeProperty ( Database database , String deviceName , List < String > pipeNames ) throws DevFailed { } } | String [ ] array = new String [ 1 + pipeNames . size ( ) ] ; int i = 0 ; array [ i ++ ] = deviceName ; for ( String pipeName : pipeNames ) array [ i ++ ] = pipeName ; DeviceData argIn = new DeviceData ( ) ; argIn . insert ( array ) ; database . command_inout ( "DbDeleteAllDevicePipeProperty" , argIn ) ; |
public class FessMessages { /** * Add the created action message for the key ' constraints . Digits . message ' with parameters .
* < pre >
* message : { item } is numeric value out of bounds ( & lt ; { integer } digits & gt ; . & lt ; { fraction } digits & gt ; expected ) .
* < / pre >
* @ param property The property name for the message . ( NotNull )
* @ param fraction The parameter fraction for message . ( NotNull )
* @ param integer The parameter integer for message . ( NotNull )
* @ return this . ( NotNull ) */
public FessMessages addConstraintsDigitsMessage ( String property , String fraction , String integer ) { } } | assertPropertyNotNull ( property ) ; add ( property , new UserMessage ( CONSTRAINTS_Digits_MESSAGE , fraction , integer ) ) ; return this ; |
public class SipCall { /** * This method sends a basic response to a previously received RE - INVITE request . The response is
* constructed based on the parameters passed in . Call this method after waitForReinvite ( ) returns
* non - null . Call this method multiple times to send multiple responses to the received RE - INVITE .
* @ param siptrans This is the object that was returned by method waitForReinvite ( ) . It identifies
* a specific RE - INVITE transaction .
* @ param statusCode The status code of the response to send ( may use SipResponse constants ) .
* @ param reasonPhrase If not null , the reason phrase to send .
* @ param expires If not - 1 , an expiration time is added to the response . This parameter indicates
* the duration the message is valid , in seconds .
* @ param newContact An URI string ( ex : sip : bob @ 192.0.2.4:5093 ) for updating the remote target URI
* kept by the far end ( target refresh ) , or null to not change that information .
* @ param displayName Display name to set in the contact header sent to the far end if newContact
* is not null .
* @ param body A String to be used as the body of the message , for changing the media session . Use
* null for no body bytes .
* @ param contentType The body content type ( ie , ' application ' part of ' application / sdp ' ) ,
* required if there is to be any content ( even if body bytes length 0 ) . Use null for no
* message content .
* @ param contentSubType The body content sub - type ( ie , ' sdp ' part of ' application / sdp ' ) , required
* if there is to be any content ( even if body bytes length 0 ) . Use null for no message
* content .
* @ return true if the response was successfully sent , false otherwise . */
public boolean respondToReinvite ( SipTransaction siptrans , int statusCode , String reasonPhrase , int expires , String newContact , String displayName , String body , String contentType , String contentSubType ) { } } | return respondToReinvite ( siptrans , statusCode , reasonPhrase , expires , newContact , displayName , body , contentType , contentSubType , null , null ) ; |
public class Consumers { /** * Yields nth ( 1 - based ) element of the iterator .
* @ param < E > the iterator element type
* @ param count the element cardinality
* @ param iterator the iterator that will be consumed
* @ return the nth element */
public static < E > E nth ( long count , Iterator < E > iterator ) { } } | final Iterator < E > filtered = new FilteringIterator < E > ( iterator , new Nth < E > ( count ) ) ; return new FirstElement < E > ( ) . apply ( filtered ) ; |
public class ContactTypeLevelOneField { /** * Get ( or make ) the current record for this reference . */
public Record makeReferenceRecord ( RecordOwner recordOwner ) { } } | Record record = super . makeReferenceRecord ( recordOwner ) ; record . addListener ( new CompareFileFilter ( record . getField ( ContactType . LEVEL ) , "1" , DBConstants . EQUALS , null , true ) ) ; return record ; |
public class ProviderFactory { /** * Liberty Change for CXF Begin */
@ FFDCIgnore ( value = { } } | Throwable . class } ) // Liberty Change for CXF End
protected static Object createProvider ( String className , Bus bus ) { try { Class < ? > cls = ClassLoaderUtils . loadClass ( className , ProviderFactory . class ) ; for ( Constructor < ? > c : cls . getConstructors ( ) ) { if ( c . getParameterTypes ( ) . length == 1 && c . getParameterTypes ( ) [ 0 ] == Bus . class ) { return c . newInstance ( bus ) ; } } return cls . newInstance ( ) ; } catch ( Throwable ex ) { String message = "Problem with creating the default provider " + className ; if ( ex . getMessage ( ) != null ) { message += ": " + ex . getMessage ( ) ; } else { message += ", exception class : " + ex . getClass ( ) . getName ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , message ) ; } } return null ; |
public class PrincipalUserDto { /** * Converts a user entity to DTO .
* @ param user The entity to convert .
* @ return The DTO .
* @ throws WebApplicationException If an error occurs . */
public static PrincipalUserDto transformToDto ( PrincipalUser user ) { } } | if ( user == null ) { throw new WebApplicationException ( "Null entity object cannot be converted to Dto object." , Status . INTERNAL_SERVER_ERROR ) ; } PrincipalUserDto result = createDtoObject ( PrincipalUserDto . class , user ) ; for ( Dashboard dashboard : user . getOwnedDashboards ( ) ) { result . addOwnedDashboardId ( dashboard . getId ( ) ) ; } return result ; |
public class RoleAssignmentsInner { /** * Creates a role assignment by ID .
* @ param roleId The ID of the role assignment to create .
* @ param parameters Parameters for the role assignment .
* @ 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 RoleAssignmentInner object if successful . */
public RoleAssignmentInner createById ( String roleId , RoleAssignmentCreateParameters parameters ) { } } | return createByIdWithServiceResponseAsync ( roleId , parameters ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class InterpretterConfig { /** * Default binding to be used in groovy interpreters .
* Dumpling exposed API is available via < tt > D < / tt > property . */
public Binding getDefaultBinding ( @ Nonnull ProcessStream stream , @ Nonnull List < String > args , @ Nullable ProcessRuntime < ? , ? , ? > runtime ) { } } | Binding binding = new Binding ( ) ; binding . setProperty ( "out" , stream . out ( ) ) ; binding . setProperty ( "err" , stream . err ( ) ) ; binding . setProperty ( "D" , new GroovyApiEntryPoint ( args , runtime , "D" ) ) ; return binding ; |
public class IronJacamar { /** * { @ inheritDoc } */
@ Override protected Statement withBeforeClasses ( final Statement statement ) { } } | final Statement beforeClasses = super . withBeforeClasses ( new NoopStatement ( ) ) ; return new Statement ( ) { @ Override public void evaluate ( ) throws Throwable { TestClass tc = getTestClass ( ) ; boolean fullProfile = true ; Configuration configuration = tc . getAnnotation ( Configuration . class ) ; if ( configuration != null ) fullProfile = configuration . full ( ) ; extensionStart ( tc ) ; embedded = EmbeddedFactory . create ( fullProfile ) ; embedded . startup ( ) ; Initializer initializer = tc . getAnnotation ( Initializer . class ) ; if ( initializer != null && initializer . clazz ( ) != null ) { try { Class < ? extends Beans > iClz = initializer . clazz ( ) ; Beans bC = iClz . newInstance ( ) ; bC . execute ( new EmbeddedJCAResolver ( embedded ) ) ; } catch ( Exception e ) { throw new Exception ( "Initializer error from: " + initializer . clazz ( ) , e ) ; } } PreCondition preCondition = tc . getAnnotation ( PreCondition . class ) ; if ( preCondition != null && preCondition . condition ( ) != null ) { try { Class < ? extends Condition > pCClz = preCondition . condition ( ) ; Condition pC = pCClz . newInstance ( ) ; pC . verify ( new EmbeddedJCAResolver ( embedded ) ) ; } catch ( Exception e ) { throw new ConditionException ( "PreCondition error from: " + preCondition . condition ( ) , e ) ; } } // Static @ Deployment
List < FrameworkMethod > fms = tc . getAnnotatedMethods ( Deployment . class ) ; if ( fms != null && ! fms . isEmpty ( ) ) { Collection < FrameworkMethod > filtered = filterAndSort ( fms , true ) ; for ( FrameworkMethod fm : filtered ) { SecurityActions . setAccessible ( fm . getMethod ( ) ) ; Class < ? > returnType = fm . getReturnType ( ) ; if ( URL . class . isAssignableFrom ( returnType ) ) { Object [ ] parameters = getParameters ( fm ) ; URL result = ( URL ) fm . invokeExplosively ( null , parameters ) ; embedded . deploy ( result ) ; staticDeployments . add ( result ) ; } else if ( ResourceAdapterArchive . class . isAssignableFrom ( returnType ) ) { Object [ ] parameters = getParameters ( fm ) ; ResourceAdapterArchive result = ( ResourceAdapterArchive ) fm . invokeExplosively ( null , parameters ) ; embedded . deploy ( result ) ; staticDeployments . add ( result ) ; } else if ( Descriptor . class . isAssignableFrom ( returnType ) ) { Object [ ] parameters = getParameters ( fm ) ; Descriptor result = ( Descriptor ) fm . invokeExplosively ( null , parameters ) ; embedded . deploy ( result ) ; staticDeployments . add ( result ) ; } else { throw new Exception ( "Unsupported deployment type: " + returnType . getName ( ) ) ; } } } // Static @ Inject / @ Named
List < FrameworkField > fields = tc . getAnnotatedFields ( javax . inject . Inject . class ) ; if ( fields != null && ! fields . isEmpty ( ) ) { for ( FrameworkField f : fields ) { if ( Modifier . isStatic ( f . getField ( ) . getModifiers ( ) ) ) { SecurityActions . setAccessible ( f . getField ( ) ) ; if ( Embedded . class . equals ( f . getType ( ) ) ) { f . getField ( ) . set ( null , embedded ) ; } else { javax . inject . Named name = f . getAnnotation ( javax . inject . Named . class ) ; if ( name != null && name . value ( ) != null ) { Object value = embedded . lookup ( name . value ( ) , f . getType ( ) ) ; f . getField ( ) . set ( null , value ) ; } else { Object value = embedded . lookup ( f . getType ( ) . getSimpleName ( ) , f . getType ( ) ) ; f . getField ( ) . set ( null , value ) ; } } } } } // Static @ Resource
fields = tc . getAnnotatedFields ( Resource . class ) ; if ( fields != null && ! fields . isEmpty ( ) ) { Context context = createContext ( ) ; for ( FrameworkField f : fields ) { SecurityActions . setAccessible ( f . getField ( ) ) ; if ( Modifier . isStatic ( f . getField ( ) . getModifiers ( ) ) ) { Resource resource = ( Resource ) f . getAnnotation ( Resource . class ) ; String name = null ; if ( resource . mappedName ( ) != null ) { name = resource . mappedName ( ) ; } else if ( resource . name ( ) != null ) { name = resource . name ( ) ; } else if ( resource . lookup ( ) != null ) { name = resource . lookup ( ) ; } f . getField ( ) . set ( null , context . lookup ( name ) ) ; } } context . close ( ) ; } beforeClasses . evaluate ( ) ; statement . evaluate ( ) ; } } ; |
public class HammingDistanceFunction { /** * Version for number vectors .
* @ param o1 First vector
* @ param o2 Second vector
* @ return hamming distance */
private double hammingDistanceNumberVector ( NumberVector o1 , NumberVector o2 ) { } } | final int d1 = o1 . getDimensionality ( ) , d2 = o2 . getDimensionality ( ) ; int differences = 0 ; int d = 0 ; for ( ; d < d1 && d < d2 ; d ++ ) { double v1 = o1 . doubleValue ( d ) , v2 = o2 . doubleValue ( d ) ; if ( v1 != v1 || v2 != v2 ) { /* NaN */
continue ; } if ( v1 != v2 ) { ++ differences ; } } for ( ; d < d1 ; d ++ ) { double v1 = o1 . doubleValue ( d ) ; if ( v1 != 0. && v1 == v1 /* not NaN */
) { ++ differences ; } } for ( ; d < d2 ; d ++ ) { double v2 = o2 . doubleValue ( d ) ; if ( v2 != 0. && v2 == v2 /* not NaN */
) { ++ differences ; } } return differences ; |
public class CliClient { /** * Get AbstractType by function name
* @ param functionName - name of the function e . g . utf8 , integer , long etc .
* @ return AbstractType type corresponding to the function name */
public static AbstractType < ? > getTypeByFunction ( String functionName ) { } } | Function function ; try { function = Function . valueOf ( functionName . toUpperCase ( ) ) ; } catch ( IllegalArgumentException e ) { String message = String . format ( "Function '%s' not found. Available functions: %s" , functionName , Function . getFunctionNames ( ) ) ; throw new RuntimeException ( message , e ) ; } return function . getValidator ( ) ; |
public class RandomUtil { /** * Returns a new Random object that can be used . The Random object returned
* is promised to be a reasonably high quality PSRND with low memory
* overhead that is faster to sample from than the default Java
* { @ link Random } . Essentially , it will be better than Java ' s default PRNG
* in every way . < br >
* < br >
* By default , multiple calls to this method will result in multiple ,
* different , seeds . Controlling the base seed and its behavior can be done
* using { @ link # DEFAULT _ SEED } and { @ link # INCREMENT _ SEEDS } .
* @ return a new random number generator to use . */
public static Random getRandom ( ) { } } | int seed ; if ( INCREMENT_SEEDS ) seed = DEFAULT_SEED . getAndAdd ( SEED_INCREMENT ) ; else seed = DEFAULT_SEED . get ( ) ; return new XORWOW ( seed ) ; |
public class JobInProgress { /** * Update the job start / launch time ( upon restart ) and log to history */
synchronized void updateJobInfo ( long startTime , long launchTime ) { } } | // log and change to the job ' s start / launch time
this . startTime = startTime ; this . launchTime = launchTime ; JobHistory . JobInfo . logJobInfo ( jobId , startTime , launchTime ) ; |
public class AbstractIoService { /** * { @ inheritDoc } */
@ Override public final void dispose ( ) { } } | if ( disposed ) { return ; } IoFuture disposalFuture ; synchronized ( disposalLock ) { disposalFuture = this . disposalFuture ; if ( ! disposing ) { disposing = true ; try { this . disposalFuture = disposalFuture = dispose0 ( ) ; } catch ( Exception e ) { IoSession ioSession = this . disposalFuture != null ? this . disposalFuture . getSession ( ) : null ; ExceptionMonitor . getInstance ( ) . exceptionCaught ( e , ioSession ) ; } finally { if ( disposalFuture == null ) { disposed = true ; } } } } if ( disposalFuture != null ) { disposalFuture . awaitUninterruptibly ( ) ; } if ( createdExecutor ) { ExecutorService e = ( ExecutorService ) executor ; e . shutdown ( ) ; while ( ! e . isTerminated ( ) ) { try { e . awaitTermination ( Integer . MAX_VALUE , TimeUnit . SECONDS ) ; } catch ( InterruptedException e1 ) { // Ignore ; it should end shortly .
} } } disposed = true ; |
public class UkWaCDocumentIterator { /** * Returns the next document from the file . */
public LabeledDocument next ( ) { } } | LabeledDocument next = nextDoc ; try { advance ( ) ; } catch ( IOException ioe ) { throw new IOError ( ioe ) ; } return next ; |
public class UserRoleJetty { /** * < p > Setter for role . < / p >
* @ param pRole reference */
public final void setItsRole ( final RoleJetty pRole ) { } } | this . itsRole = pRole ; if ( this . itsId == null ) { this . itsId = new IdUserRoleJetty ( ) ; } this . itsId . setItsRole ( this . itsRole ) ; |
public class WorkItemConfigurationsInner { /** * Gets the list work item configurations that exist for the application .
* @ param resourceGroupName The name of the resource group .
* @ param resourceName The name of the Application Insights component resource .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the List & lt ; WorkItemConfigurationInner & gt ; object */
public Observable < List < WorkItemConfigurationInner > > listAsync ( String resourceGroupName , String resourceName ) { } } | return listWithServiceResponseAsync ( resourceGroupName , resourceName ) . map ( new Func1 < ServiceResponse < List < WorkItemConfigurationInner > > , List < WorkItemConfigurationInner > > ( ) { @ Override public List < WorkItemConfigurationInner > call ( ServiceResponse < List < WorkItemConfigurationInner > > response ) { return response . body ( ) ; } } ) ; |
public class RowCell { /** * Creates a new instance of the { @ link RowCell } . */
@ InternalApi public static RowCell create ( @ Nonnull String family , @ Nonnull ByteString qualifier , long timestamp , @ Nonnull List < String > labels , @ Nonnull ByteString value ) { } } | return new AutoValue_RowCell ( family , qualifier , timestamp , value , labels ) ; |
public class JobsInner { /** * Gets a list of Jobs within the specified Experiment .
* @ param nextPageLink The NextLink from the previous successful call to List operation .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the PagedList & lt ; JobInner & gt ; object */
public Observable < Page < JobInner > > listByExperimentNextAsync ( final String nextPageLink ) { } } | return listByExperimentNextWithServiceResponseAsync ( nextPageLink ) . map ( new Func1 < ServiceResponse < Page < JobInner > > , Page < JobInner > > ( ) { @ Override public Page < JobInner > call ( ServiceResponse < Page < JobInner > > response ) { return response . body ( ) ; } } ) ; |
public class ScroogeReadSupport { /** * Validates that the requested group type projection is compatible .
* This allows the projection schema to have extra optional fields .
* @ param fileType the typed schema of the source
* @ param projection requested projection schema */
public static void assertGroupsAreCompatible ( GroupType fileType , GroupType projection ) { } } | List < Type > fields = projection . getFields ( ) ; for ( Type otherType : fields ) { if ( fileType . containsField ( otherType . getName ( ) ) ) { Type thisType = fileType . getType ( otherType . getName ( ) ) ; assertAreCompatible ( thisType , otherType ) ; if ( ! otherType . isPrimitive ( ) ) { assertGroupsAreCompatible ( thisType . asGroupType ( ) , otherType . asGroupType ( ) ) ; } } else if ( otherType . getRepetition ( ) == Type . Repetition . REQUIRED ) { throw new InvalidRecordException ( otherType . getName ( ) + " not found in " + fileType ) ; } } |
public class ConfigManager { /** * Adds the local configuration { @ link LocalConfig } associated with name . Over - rides any config with the same name .
* @ param config
* The LocalConfig .
* @ param name
* The name to associate with local config . */
public static synchronized void addConfig ( String name , LocalConfig config ) { } } | SeLionLogger . getLogger ( ) . entering ( new Object [ ] { name , config } ) ; checkArgument ( StringUtils . isNotBlank ( name ) , "A testname for which configuration is being added cannot be null (or) empty." ) ; checkArgument ( config != null , "A configuration object cannot be null." ) ; if ( configsMap . containsKey ( name ) ) { String message = "Overwriting an already existing configuration" ; SeLionLogger . getLogger ( ) . warning ( message ) ; } configsMap . put ( name , config ) ; SeLionLogger . getLogger ( ) . exiting ( ) ; |
public class QrCodeDecoderBits { /** * Decodes a numeric message
* @ param qr QR code
* @ param data encoded data
* @ return Location it has read up to in bits */
private int decodeNumeric ( QrCode qr , PackedBits8 data , int bitLocation ) { } } | int lengthBits = QrCodeEncoder . getLengthBitsNumeric ( qr . version ) ; int length = data . read ( bitLocation , lengthBits , true ) ; bitLocation += lengthBits ; while ( length >= 3 ) { if ( data . size < bitLocation + 10 ) { qr . failureCause = QrCode . Failure . MESSAGE_OVERFLOW ; return - 1 ; } int chunk = data . read ( bitLocation , 10 , true ) ; bitLocation += 10 ; int valA = chunk / 100 ; int valB = ( chunk - valA * 100 ) / 10 ; int valC = chunk - valA * 100 - valB * 10 ; workString . append ( ( char ) ( valA + '0' ) ) ; workString . append ( ( char ) ( valB + '0' ) ) ; workString . append ( ( char ) ( valC + '0' ) ) ; length -= 3 ; } if ( length == 2 ) { if ( data . size < bitLocation + 7 ) { qr . failureCause = QrCode . Failure . MESSAGE_OVERFLOW ; return - 1 ; } int chunk = data . read ( bitLocation , 7 , true ) ; bitLocation += 7 ; int valA = chunk / 10 ; int valB = chunk - valA * 10 ; workString . append ( ( char ) ( valA + '0' ) ) ; workString . append ( ( char ) ( valB + '0' ) ) ; } else if ( length == 1 ) { if ( data . size < bitLocation + 4 ) { qr . failureCause = QrCode . Failure . MESSAGE_OVERFLOW ; return - 1 ; } int valA = data . read ( bitLocation , 4 , true ) ; bitLocation += 4 ; workString . append ( ( char ) ( valA + '0' ) ) ; } return bitLocation ; |
public class CommerceAccountPersistenceImpl { /** * Returns all the commerce accounts that the user has permission to view where companyId = & # 63 ; .
* @ param companyId the company ID
* @ return the matching commerce accounts that the user has permission to view */
@ Override public List < CommerceAccount > filterFindByCompanyId ( long companyId ) { } } | return filterFindByCompanyId ( companyId , QueryUtil . ALL_POS , QueryUtil . ALL_POS , null ) ; |
public class MappedSuperclass { /** * IMappedSuperclass methods */
@ Override public String _getIDClass ( ) { } } | IdClass idCls = this . getIdClass ( ) ; if ( idCls == null ) { return null ; } return idCls . getClazz ( ) ; |
public class NativeIO { /** * Wrapper around native stat ( ) */
public static Stat stat ( File file ) throws IOException { } } | if ( file == null ) { throw new IllegalArgumentException ( "Null parameter passed" ) ; } return stat ( file . getAbsolutePath ( ) ) ; |
public class MultipleHttpServiceActivator { /** * Start this service .
* Override this to do all the startup .
* @ return true if successful . */
@ Override public boolean shutdownService ( Object service , BundleContext context ) { } } | for ( String alias : getAliases ( ) ) { HttpServiceTracker serviceTracker = getServiceTracker ( context , BaseWebappServlet . ALIAS , alias ) ; if ( serviceTracker != null ) serviceTracker . close ( ) ; } return true ; |
public class SSLAlpnNegotiator { /** * Using jetty - alpn , set up a new JettyServerNotiator to handle ALPN for a given SSLEngine and link
* @ param SSLEngine
* @ param SSLConnectionLink
* @ return JettyServerNegotiator or null if ALPN was not set up */
protected JettyServerNegotiator registerJettyAlpn ( final SSLEngine engine , SSLConnectionLink link ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "registerJettyAlpn entry " + engine ) ; } try { JettyServerNegotiator negotiator = new JettyServerNegotiator ( engine , link ) ; // invoke ALPN . put ( engine , provider ( this ) )
Method m = jettyAlpn . getMethod ( "put" , SSLEngine . class , jettyProviderInterface ) ; m . invoke ( null , new Object [ ] { engine , java . lang . reflect . Proxy . newProxyInstance ( jettyServerProviderInterface . getClassLoader ( ) , new java . lang . Class [ ] { jettyServerProviderInterface } , negotiator ) } ) ; return negotiator ; } catch ( InvocationTargetException ie ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "registerJettyAlpn exception: " + ie . getTargetException ( ) ) ; } } catch ( Exception e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "registerJettyAlpn jetty-alpn exception: " + e ) ; } } return null ; |
public class VirtualMachineMBeans { /** * Dumps all of the threads ' current information to an output stream .
* @ param out an output stream */
public void getThreadDump ( OutputStream out ) { } } | final ThreadInfo [ ] threads = this . threads . dumpAllThreads ( true , true ) ; final PrintWriter writer = new PrintWriter ( out , true ) ; for ( int ti = threads . length - 1 ; ti >= 0 ; ti -- ) { final ThreadInfo t = threads [ ti ] ; writer . printf ( "%s id=%d state=%s" , t . getThreadName ( ) , t . getThreadId ( ) , t . getThreadState ( ) ) ; final LockInfo lock = t . getLockInfo ( ) ; if ( ( lock != null ) && ( t . getThreadState ( ) != State . BLOCKED ) ) { writer . printf ( "\n - waiting on <0x%08x> (a %s)" , lock . getIdentityHashCode ( ) , lock . getClassName ( ) ) ; writer . printf ( "\n - locked <0x%08x> (a %s)" , lock . getIdentityHashCode ( ) , lock . getClassName ( ) ) ; } else if ( ( lock != null ) && ( t . getThreadState ( ) == State . BLOCKED ) ) { writer . printf ( "\n - waiting to lock <0x%08x> (a %s)" , lock . getIdentityHashCode ( ) , lock . getClassName ( ) ) ; } if ( t . isSuspended ( ) ) { writer . print ( " (suspended)" ) ; } if ( t . isInNative ( ) ) { writer . print ( " (running in native)" ) ; } writer . println ( ) ; if ( t . getLockOwnerName ( ) != null ) { writer . printf ( " owned by %s id=%d\n" , t . getLockOwnerName ( ) , t . getLockOwnerId ( ) ) ; } final StackTraceElement [ ] elements = t . getStackTrace ( ) ; final MonitorInfo [ ] monitors = t . getLockedMonitors ( ) ; for ( int i = 0 ; i < elements . length ; i ++ ) { final StackTraceElement element = elements [ i ] ; writer . printf ( " at %s\n" , element ) ; for ( int j = 1 ; j < monitors . length ; j ++ ) { final MonitorInfo monitor = monitors [ j ] ; if ( monitor . getLockedStackDepth ( ) == i ) { writer . printf ( " - locked %s\n" , monitor ) ; } } } writer . println ( ) ; final LockInfo [ ] locks = t . getLockedSynchronizers ( ) ; if ( locks . length > 0 ) { writer . printf ( " Locked synchronizers: count = %d\n" , locks . length ) ; for ( LockInfo l : locks ) { writer . printf ( " - %s\n" , l ) ; } writer . println ( ) ; } } writer . println ( ) ; writer . flush ( ) ; |
public class Queue { /** * Set the unique id for this Queue . */
private static synchronized int setId ( Queue queue ) { } } | String queue_string = queue . toString ( ) ; if ( ! queues . contains ( queue_string ) ) queues . add ( queue_string ) ; return queues . indexOf ( queue_string ) ; |
public class ComputeNodesImpl { /** * Deletes a user account from the specified compute node .
* You can delete a user account to a node only when it is in the idle or running state .
* @ param poolId The ID of the pool that contains the compute node .
* @ param nodeId The ID of the machine on which you want to delete a user account .
* @ param userName The name of the user account to delete .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceResponseWithHeaders } object if successful . */
public Observable < Void > deleteUserAsync ( String poolId , String nodeId , String userName ) { } } | return deleteUserWithServiceResponseAsync ( poolId , nodeId , userName ) . map ( new Func1 < ServiceResponseWithHeaders < Void , ComputeNodeDeleteUserHeaders > , Void > ( ) { @ Override public Void call ( ServiceResponseWithHeaders < Void , ComputeNodeDeleteUserHeaders > response ) { return response . body ( ) ; } } ) ; |
public class Solo { /** * Checks if a ToggleButton displaying the specified text is checked .
* @ param text the text that the { @ link ToggleButton } displays , specified as a regular expression
* @ return { @ code true } if a { @ link ToggleButton } matching the specified text is checked and { @ code false } if it is not checked */
public boolean isToggleButtonChecked ( String text ) { } } | if ( config . commandLogging ) { Log . d ( config . commandLoggingTag , "isToggleButtonChecked(\"" + text + "\")" ) ; } return checker . isButtonChecked ( ToggleButton . class , text ) ; |
public class DefaultResilienceStrategyConfiguration { /** * Returns a configuration object bound to the given store and cache loader - writer .
* @ param store store to bind to
* @ param loaderWriter loader to bind to
* @ return a bound configuration
* @ throws IllegalStateException if the configuration is already bound */
public DefaultResilienceStrategyConfiguration bind ( RecoveryStore < ? > store , CacheLoaderWriter < ? , ? > loaderWriter ) throws IllegalStateException { } } | if ( getInstance ( ) == null ) { Object [ ] arguments = getArguments ( ) ; Object [ ] boundArguments = Arrays . copyOf ( arguments , arguments . length + 2 ) ; boundArguments [ arguments . length ] = store ; boundArguments [ arguments . length + 1 ] = loaderWriter ; return new BoundConfiguration ( getClazz ( ) , boundArguments ) ; } else { return this ; } |
public class AdminCommandQuota { /** * Parses command - line and directs to sub - commands .
* @ param args Command - line input
* @ throws Exception */
public static void executeCommand ( String [ ] args ) throws Exception { } } | String subCmd = ( args . length > 0 ) ? args [ 0 ] : "" ; args = AdminToolUtils . copyArrayCutFirst ( args ) ; if ( subCmd . equals ( "get" ) ) { SubCommandQuotaGet . executeCommand ( args ) ; } else if ( subCmd . equals ( "set" ) ) { SubCommandQuotaSet . executeCommand ( args ) ; } else if ( subCmd . equals ( "reserve-memory" ) ) { SubCommandQuotaReserveMemory . executeCommand ( args ) ; } else if ( subCmd . equals ( "unset" ) ) { SubCommandQuotaUnset . executeCommand ( args ) ; } else { printHelp ( System . out ) ; } |
public class WasInformedBy { /** * Gets the value of the label property .
* This accessor method returns a reference to the live list ,
* not a snapshot . Therefore any modification you make to the
* returned list will be present inside the JAXB object .
* This is why there is not a < CODE > set < / CODE > method for the label property .
* For example , to add a new item , do as follows :
* < pre >
* getLabel ( ) . add ( newItem ) ;
* < / pre >
* Objects of the following type ( s ) are allowed in the list
* { @ link org . openprovenance . prov . sql . InternationalizedString } */
@ OneToMany ( targetEntity = org . openprovenance . prov . sql . InternationalizedString . class , cascade = { } } | CascadeType . ALL } ) @ JoinColumn ( name = "LABEL_WASINFORMEDBY_PK" ) public List < org . openprovenance . prov . model . LangString > getLabel ( ) { if ( label == null ) { label = new ArrayList < org . openprovenance . prov . model . LangString > ( ) ; } return this . label ; |
public class ImageRequest { /** * Scales one side of a rectangle to fit aspect ratio .
* @ param maxPrimary Maximum size of the primary dimension ( i . e . width for
* max width ) , or zero to maintain aspect ratio with secondary
* dimension
* @ param maxSecondary Maximum size of the secondary dimension , or zero to
* maintain aspect ratio with primary dimension
* @ param actualPrimary Actual size of the primary dimension
* @ param actualSecondary Actual size of the secondary dimension
* @ param scaleType The ScaleType used to calculate the needed image size . */
private static int getResizedDimension ( int maxPrimary , int maxSecondary , int actualPrimary , int actualSecondary , ScaleType scaleType ) { } } | // If no dominant value at all , just return the actual .
if ( ( maxPrimary == 0 ) && ( maxSecondary == 0 ) ) { return actualPrimary ; } // If ScaleType . FIT _ XY fill the whole rectangle , ignore ratio .
if ( scaleType == ScaleType . FIT_XY ) { if ( maxPrimary == 0 ) { return actualPrimary ; } return maxPrimary ; } // If primary is unspecified , scale primary to match secondary ' s scaling ratio .
if ( maxPrimary == 0 ) { double ratio = ( double ) maxSecondary / ( double ) actualSecondary ; return ( int ) ( actualPrimary * ratio ) ; } if ( maxSecondary == 0 ) { return maxPrimary ; } double ratio = ( double ) actualSecondary / ( double ) actualPrimary ; int resized = maxPrimary ; // If ScaleType . CENTER _ CROP fill the whole rectangle , preserve aspect ratio .
if ( scaleType == ScaleType . CENTER_CROP ) { if ( ( resized * ratio ) < maxSecondary ) { resized = ( int ) ( maxSecondary / ratio ) ; } return resized ; } if ( ( resized * ratio ) > maxSecondary ) { resized = ( int ) ( maxSecondary / ratio ) ; } return resized ; |
public class MethodHandleUtil { /** * 代理对象方法
* 会根据方法名和方法参数严格匹配
* @ param target 代理对象
* @ param methodName 对象方法名
* @ param args 对象方法参数
* @ return */
public static MethodHandleProxy proxyMethod ( Object target , String methodName , Object ... args ) { } } | MethodHandle mh = findMethodHandle ( target , methodName , args ) ; if ( mh != null ) { return new MethodHandleProxy ( target , mh , args ) ; } return null ; |
public class ExportApi { /** * Get export status .
* Check the status of the specified export and return the percentage complete .
* @ param id The ID of a previously started export . ( required )
* @ return ExportStatusResponse
* @ throws ApiException If fail to call the API , e . g . server error or cannot deserialize the response body */
public ExportStatusResponse getExportStatus ( String id ) throws ApiException { } } | ApiResponse < ExportStatusResponse > resp = getExportStatusWithHttpInfo ( id ) ; return resp . getData ( ) ; |
public class RandomStringUtils { /** * < p > Creates a random string whose length is the number of characters
* specified . < / p >
* < p > Characters will be chosen from the set of alpha - numeric
* characters as indicated by the arguments . < / p >
* @ param count the length of random string to create
* @ param start the position in set of chars to start at
* @ param end the position in set of chars to end before
* @ param letters if { @ code true } , generated string may include
* alphabetic characters
* @ param numbers if { @ code true } , generated string may include
* numeric characters
* @ return the random string */
public static String random ( final int count , final int start , final int end , final boolean letters , final boolean numbers ) { } } | return random ( count , start , end , letters , numbers , null , RANDOM ) ; |
public class TableFactorBuilder { /** * Gets a { @ code TableFactorBuilder } where each outcome is initialized with a
* weight of 1.
* @ param variables
* @ return */
public static TableFactorBuilder ones ( VariableNumMap variables ) { } } | TableFactorBuilder builder = new TableFactorBuilder ( variables ) ; Iterator < Assignment > allAssignmentIter = new AllAssignmentIterator ( variables ) ; while ( allAssignmentIter . hasNext ( ) ) { builder . setWeight ( allAssignmentIter . next ( ) , 1.0 ) ; } return builder ; |
public class ModelsImpl { /** * Delete an entity role .
* @ param appId The application ID .
* @ param versionId The version ID .
* @ param entityId The entity ID .
* @ param roleId The entity role Id .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the OperationStatus object */
public Observable < OperationStatus > deleteClosedListEntityRoleAsync ( UUID appId , String versionId , UUID entityId , UUID roleId ) { } } | return deleteClosedListEntityRoleWithServiceResponseAsync ( appId , versionId , entityId , roleId ) . map ( new Func1 < ServiceResponse < OperationStatus > , OperationStatus > ( ) { @ Override public OperationStatus call ( ServiceResponse < OperationStatus > response ) { return response . body ( ) ; } } ) ; |
public class CmsAliasView { /** * Ensures that rows with errors will be placed at the top of the table . < p > */
public void sortByErrors ( ) { } } | ColumnSortList columnSort = m_table . getColumnSortList ( ) ; columnSort . clear ( ) ; columnSort . push ( m_table . getErrorColumn ( ) ) ; columnSort . push ( m_table . getErrorColumn ( ) ) ; ColumnSortEvent . fire ( m_table , columnSort ) ; |
public class ConfluenceGreenPepper { /** * < p > getPageContent . < / p >
* @ param currentPage a { @ link com . atlassian . confluence . pages . Page } object .
* @ param implementedVersion a { @ link java . lang . Boolean } object .
* @ return a { @ link java . lang . String } object .
* @ throws com . greenpepper . server . GreenPepperServerException if any . */
public String getPageContent ( Page currentPage , Boolean implementedVersion ) throws GreenPepperServerException { } } | AbstractPage page = currentPage ; if ( implementedVersion ) { page = getImplementedPage ( currentPage ) ; } return getBodyTypeAwareRenderer ( ) . render ( page ) ; |
public class Materials { /** * 获取图文素材
* @ param mediaId media id
* @ return 图文素材 */
public MpNews getMpNews ( String mediaId ) { } } | String url = WxEndpoint . get ( "url.material.mpnews.get" ) ; String json = String . format ( "{\"media_id\":\"%s\"}" , mediaId ) ; logger . info ( "get mpnews: {}" , json ) ; String response = wxClient . post ( url , json ) ; return JsonMapper . defaultMapper ( ) . fromJson ( response , MpNews . class ) ; |
public class CATConsumer { /** * Resets a browser session . This implementation barfs because this method should
* never be invoked on anything other than a CATBrowseConsumer ( which overrides it ) . */
public void reset ( ) throws SISessionUnavailableException , SISessionDroppedException , SIConnectionUnavailableException , SIConnectionDroppedException , SIResourceException , SIConnectionLostException , SIErrorException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "reset" ) ; SIErrorException e = new SIErrorException ( nls . getFormattedMessage ( "PROTOCOL_ERROR_SICO2003" , null , null ) ) ; FFDCFilter . processException ( e , CLASS_NAME + ".reset" , CommsConstants . CATCONSUMER_RESET_01 , this ) ; SibTr . error ( tc , "PROTOCOL_ERROR_SICO2003" , e ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "reset" ) ; // Re - throw this exception so that the client will informed if required
throw e ; |
public class Monos { /** * Perform a For Comprehension over a Mono , accepting a generating function .
* This results in a two level nested internal iteration over the provided Monos .
* < pre >
* { @ code
* import static cyclops . companion . reactor . Monos . forEach ;
* forEach ( Mono . just ( 1 ) ,
* a - > Mono . just ( a + 1 ) ,
* Tuple : : tuple )
* < / pre >
* @ param value1 top level Mono
* @ param value2 Nested Mono
* @ param yieldingFunction Generates a result per combination
* @ return Mono with a combined value generated by the yielding function */
public static < T , R1 , R > Mono < R > forEach ( Mono < ? extends T > value1 , Function < ? super T , Mono < R1 > > value2 , BiFunction < ? super T , ? super R1 , ? extends R > yieldingFunction ) { } } | Future < R > res = Future . fromPublisher ( value1 ) . flatMap ( in -> { Future < R1 > a = Future . fromPublisher ( value2 . apply ( in ) ) ; return a . map ( ina -> yieldingFunction . apply ( in , ina ) ) ; } ) ; return Mono . from ( res ) ; |
public class CmsXmlDocumentComparison { /** * Returns the elements . < p >
* @ return the elements */
public List < CmsElementComparison > getElements ( ) { } } | if ( m_elements == null ) { return Collections . emptyList ( ) ; } return Collections . unmodifiableList ( m_elements ) ; |
public class GobblinHelixJobLauncher { /** * Inject in some additional properties
* @ param jobProps job properties
* @ param inputTags list of metadata tags
* @ return */
private static List < ? extends Tag < ? > > addAdditionalMetadataTags ( Properties jobProps , List < ? extends Tag < ? > > inputTags ) { } } | List < Tag < ? > > metadataTags = Lists . newArrayList ( inputTags ) ; String jobId ; // generate job id if not already set
if ( jobProps . containsKey ( ConfigurationKeys . JOB_ID_KEY ) ) { jobId = jobProps . getProperty ( ConfigurationKeys . JOB_ID_KEY ) ; } else { jobId = JobLauncherUtils . newJobId ( JobState . getJobNameFromProps ( jobProps ) ) ; jobProps . put ( ConfigurationKeys . JOB_ID_KEY , jobId ) ; } String jobExecutionId = Long . toString ( Id . Job . parse ( jobId ) . getSequence ( ) ) ; // only inject flow tags if a flow name is defined
if ( jobProps . containsKey ( ConfigurationKeys . FLOW_NAME_KEY ) ) { metadataTags . add ( new Tag < > ( TimingEvent . FlowEventConstants . FLOW_GROUP_FIELD , jobProps . getProperty ( ConfigurationKeys . FLOW_GROUP_KEY , "" ) ) ) ; metadataTags . add ( new Tag < > ( TimingEvent . FlowEventConstants . FLOW_NAME_FIELD , jobProps . getProperty ( ConfigurationKeys . FLOW_NAME_KEY ) ) ) ; // use job execution id if flow execution id is not present
metadataTags . add ( new Tag < > ( TimingEvent . FlowEventConstants . FLOW_EXECUTION_ID_FIELD , jobProps . getProperty ( ConfigurationKeys . FLOW_EXECUTION_ID_KEY , jobExecutionId ) ) ) ; } metadataTags . add ( new Tag < > ( TimingEvent . FlowEventConstants . JOB_GROUP_FIELD , jobProps . getProperty ( ConfigurationKeys . JOB_GROUP_KEY , "" ) ) ) ; metadataTags . add ( new Tag < > ( TimingEvent . FlowEventConstants . JOB_NAME_FIELD , jobProps . getProperty ( ConfigurationKeys . JOB_NAME_KEY , "" ) ) ) ; metadataTags . add ( new Tag < > ( TimingEvent . FlowEventConstants . JOB_EXECUTION_ID_FIELD , jobExecutionId ) ) ; LOGGER . debug ( "GobblinHelixJobLauncher.addAdditionalMetadataTags: metadataTags {}" , metadataTags ) ; return metadataTags ; |
public class TimelineBarrier { /** * 判断自己的timestamp是否可以通过 , 带超时控制
* @ throws InterruptedException
* @ throws TimeoutException */
public void await ( Event event , long timeout , TimeUnit unit ) throws InterruptedException , TimeoutException { } } | long timestamp = getTimestamp ( event ) ; try { lock . lockInterruptibly ( ) ; single ( timestamp ) ; while ( isPermit ( event , timestamp ) == false ) { condition . await ( timeout , unit ) ; } } finally { lock . unlock ( ) ; } |
public class VehicleManager { /** * Register to receive asynchronous updates for a specific VehicleMessage
* type .
* Use this method to register an object implementing the
* VehicleMessage . Listener interface to receive real - time updates
* whenever a new value is received for the specified message type .
* Make sure you unregister your listeners with
* VehicleManager . removeListener ( . . . ) when your activity or service closes
* and no longer requires updates .
* @ param messageType The class of the VehicleMessage
* ( e . g . SimpleVehicleMessage . class ) the listener is listening for
* @ param listener An listener instance to receive the callback . */
public void addListener ( Class < ? extends VehicleMessage > messageType , VehicleMessage . Listener listener ) { } } | Log . i ( TAG , "Adding listener " + listener + " for " + messageType ) ; mNotifier . register ( messageType , listener ) ; |
public class AuditorFactory { /** * Create a new instance of the specified IHE Auditor non - abstract subclass that
* implements the auditor API .
* @ param clazzClass instance to instantiate a new instance for
* @ return New IHE Auditor instance */
private static IHEAuditor getAuditorForClass ( Class < ? extends IHEAuditor > clazz ) { } } | if ( null == clazz ) { LOGGER . error ( "Error - Cannot specify a null auditor class" ) ; } else { try { return clazz . newInstance ( ) ; } catch ( ClassCastException e ) { LOGGER . error ( "The requested class " + clazz . getName ( ) + " is not a valid auditor" , e ) ; } catch ( Exception e ) { LOGGER . error ( "Error creating the auditor for class " + clazz . getName ( ) , e ) ; } } return null ; |
public class MergeSmallRegions { /** * Go through each pixel in the image and examine its neighbors according to a 4 - connect rule . If one of
* the pixels is in a region that is to be pruned mark them as neighbors . The image is traversed such that
* the number of comparisons is minimized . */
protected void findAdjacentRegions ( GrayS32 pixelToRegion ) { } } | // - - - - - Do the inner pixels first
if ( connect . length == 4 ) adjacentInner4 ( pixelToRegion ) ; else if ( connect . length == 8 ) { adjacentInner8 ( pixelToRegion ) ; } adjacentBorder ( pixelToRegion ) ; |
public class ElasticSearchRestDAOV5 { /** * Determines whether a resource exists in ES . This will call a GET method to a particular path and
* return true if status 200 ; false otherwise .
* @ param resourcePath The path of the resource to get .
* @ return True if it exists ; false otherwise .
* @ throws IOException If an error occurred during requests to ES . */
public boolean doesResourceExist ( final String resourcePath ) throws IOException { } } | Response response = elasticSearchAdminClient . performRequest ( HttpMethod . HEAD , resourcePath ) ; return response . getStatusLine ( ) . getStatusCode ( ) == HttpStatus . SC_OK ; |
public class CmmnExecution { /** * sentry : ( 2 ) handle transitions */
public void handleChildTransition ( CmmnExecution child , String transition ) { } } | // Step 1 : collect all affected sentries
List < String > affectedSentries = collectAffectedSentries ( child , transition ) ; // Step 2 : fire force update on all case sentry part
// contained by a affected sentry to provoke an
// OptimisticLockingException
forceUpdateOnSentries ( affectedSentries ) ; // Step 3 : check each affected sentry whether it is satisfied .
// the returned list contains all satisfied sentries
List < String > satisfiedSentries = getSatisfiedSentries ( affectedSentries ) ; // Step 4 : reset sentries - > satisfied = = false
resetSentries ( satisfiedSentries ) ; // Step 5 : fire satisfied sentries
fireSentries ( satisfiedSentries ) ; |
public class Error { /** * Get the error as a string in html format
* @ return error in html format */
public String toHtml ( ) { } } | StringBuilder stringBuilder = new StringBuilder ( ) ; stringBuilder . append ( "<p>" ) . append ( objectNode . get ( TYPE ) . asText ( ) ) . append ( ": " ) . append ( objectNode . get ( MESSAGE ) . asText ( ) ) . append ( " -> " ) . append ( objectNode . get ( DETAILS ) . toString ( ) ) . append ( "</p>" ) ; return stringBuilder . toString ( ) ; |
public class Icon { /** * Copies the values from { @ link Icon base } to this { @ link Icon } .
* @ param base the icon to copy from */
@ Override public void copyFrom ( TextureAtlasSprite base ) { } } | this . originX = base . getOriginX ( ) ; this . originY = base . getOriginY ( ) ; this . width = base . getIconWidth ( ) ; this . height = base . getIconHeight ( ) ; this . minU = base . getMinU ( ) ; this . maxU = base . getMaxU ( ) ; this . minV = base . getMinV ( ) ; this . maxV = base . getMaxV ( ) ; for ( int i = 0 ; i < base . getFrameCount ( ) ; i ++ ) this . framesTextureData . add ( base . getFrameTextureData ( i ) ) ; if ( base instanceof Icon ) { Icon mbase = ( Icon ) base ; this . sheetWidth = mbase . sheetWidth ; this . sheetHeight = mbase . sheetHeight ; this . flippedU = mbase . flippedU ; this . flippedV = mbase . flippedV ; } |
public class GeneratedDUserDaoImpl { /** * query - by method for field updatedBy
* @ param updatedBy the specified attribute
* @ return an Iterable of DUsers for the specified updatedBy */
public Iterable < DUser > queryByUpdatedBy ( java . lang . String updatedBy ) { } } | return queryByField ( null , DUserMapper . Field . UPDATEDBY . getFieldName ( ) , updatedBy ) ; |
public class JobState { /** * Get { @ link TaskState } s of { @ link Task } s of this job .
* @ return a list of { @ link TaskState } s */
public List < TaskState > getTaskStates ( ) { } } | return ImmutableList . < TaskState > builder ( ) . addAll ( this . taskStates . values ( ) ) . build ( ) ; |
public class LimesurveyRC { /** * Gets participant properties .
* @ param surveyId the survey id of the participant ' s survey
* @ param token the token of the participant
* @ param tokenProperties the token properties
* @ return the participant properties
* @ throws LimesurveyRCException the limesurvey rc exception */
public Map < String , String > getParticipantProperties ( int surveyId , String token , List < String > tokenProperties ) throws LimesurveyRCException { } } | LsApiBody . LsApiParams params = getParamsWithKey ( surveyId ) ; Map < String , String > queryProperties = new HashMap < > ( ) ; queryProperties . put ( "token" , token ) ; params . setTokenQueryProperties ( queryProperties ) ; params . setTokenProperties ( tokenProperties ) ; return gson . fromJson ( callRC ( new LsApiBody ( "get_participant_properties" , params ) ) , new TypeToken < Map < String , String > > ( ) { } . getType ( ) ) ; |
public class IncludeWebClass { /** * Builds a HTTP service from a method .
* < pre > < code >
* & # 64 ; Get
* void myMethod ( & 64 ; Query ( " id " ) id , Result & lt ; String & gt ; result ) ;
* < / code > < / pre >
* Method parameters are filled from the request .
* @ param builder called to create the service
* @ param beanFactory factory for the bean instance
* @ param method method for the service */
private static ServiceWeb buildWebService ( WebBuilder builder , Function < RequestWeb , Object > beanFactory , Method method ) { } } | Parameter [ ] params = method . getParameters ( ) ; WebParam [ ] webParam = new WebParam [ params . length ] ; for ( int i = 0 ; i < params . length ; i ++ ) { webParam [ i ] = buildParam ( builder , params [ i ] ) ; } return new WebServiceMethod ( beanFactory , method , webParam ) ; |
public class BlobInfo { /** * Returns a { @ code BlobInfo } builder where blob identity is set using the provided values . */
public static Builder newBuilder ( BucketInfo bucketInfo , String name ) { } } | return newBuilder ( bucketInfo . getName ( ) , name ) ; |
public class Engine { /** * Indicates whether an input variable of the given name is in the input
* variables
* @ param name is the name of the input variable
* @ return whether an input variable is registered with the given name */
public boolean hasInputVariable ( String name ) { } } | for ( InputVariable inputVariable : this . inputVariables ) { if ( inputVariable . getName ( ) . equals ( name ) ) { return true ; } } return false ; |
public class PhaseTwoApplication { /** * Returns the application ' s description .
* @ return String */
@ Override public String getApplicationDescription ( ) { } } | final StringBuilder bldr = new StringBuilder ( ) ; bldr . append ( "Merges proto-networks into a composite network and " ) ; bldr . append ( "equivalences term references across namespaces." ) ; return bldr . toString ( ) ; |
public class CmsJspTagEditable { /** * Checks if the current request should be direct edit enabled . < p >
* @ param req the servlet request
* @ return < code > true < / code > if the current request should be direct edit enabled */
public static boolean isEditableRequest ( ServletRequest req ) { } } | boolean result = false ; if ( CmsHistoryResourceHandler . isHistoryRequest ( req ) || CmsJspTagEnableAde . isDirectEditDisabled ( req ) ) { // don ' t display direct edit buttons on an historical resource
result = false ; } else { CmsFlexController controller = CmsFlexController . getController ( req ) ; CmsObject cms = controller . getCmsObject ( ) ; result = ! cms . getRequestContext ( ) . getCurrentProject ( ) . isOnlineProject ( ) && ! CmsResource . isTemporaryFileName ( cms . getRequestContext ( ) . getUri ( ) ) ; } return result ; |
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EClass getIfcDuctSegmentType ( ) { } } | if ( ifcDuctSegmentTypeEClass == null ) { ifcDuctSegmentTypeEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 203 ) ; } return ifcDuctSegmentTypeEClass ; |
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EClass getIfcPlanarExtent ( ) { } } | if ( ifcPlanarExtentEClass == null ) { ifcPlanarExtentEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 426 ) ; } return ifcPlanarExtentEClass ; |
public class CmsWorkplaceManager { /** * Adds newly created export point to the workplace configuration . < p >
* @ param uri the export point uri
* @ param destination the export point destination */
public void addExportPoint ( String uri , String destination ) { } } | CmsExportPoint point = new CmsExportPoint ( uri , destination ) ; m_exportPoints . add ( point ) ; if ( CmsLog . INIT . isInfoEnabled ( ) && ( point . getDestinationPath ( ) != null ) ) { CmsLog . INIT . info ( Messages . get ( ) . getBundle ( ) . key ( Messages . INIT_ADD_EXPORT_POINT_2 , point . getUri ( ) , point . getDestinationPath ( ) ) ) ; } |
public class ZonedDateTime { /** * Returns a copy of this { @ code ZonedDateTime } with the specified number of seconds subtracted .
* This operates on the instant time - line , such that subtracting one second will
* always be a duration of one second earlier .
* This may cause the local date - time to change by an amount other than one second .
* Note that this is a different approach to that used by days , months and years .
* This instance is immutable and unaffected by this method call .
* @ param seconds the seconds to subtract , may be negative
* @ return a { @ code ZonedDateTime } based on this date - time with the seconds subtracted , not null
* @ throws DateTimeException if the result exceeds the supported date range */
public ZonedDateTime minusSeconds ( long seconds ) { } } | return ( seconds == Long . MIN_VALUE ? plusSeconds ( Long . MAX_VALUE ) . plusSeconds ( 1 ) : plusSeconds ( - seconds ) ) ; |
public class ExceptionSoftener { /** * Soften a CheckedBiFunction that can throw Checked Exceptions to a standard BiFunction that can also throw Checked Exceptions ( without declaring them )
* < pre >
* { @ code
* ExceptionSoftener . softenBiFunction ( this : : loadDir ) . applyHKT ( " . core " , " / tmp / dir " ) ;
* public String loadDir ( String fileExt , String dir ) throws IOException
* < / pre >
* @ param fn CheckedBiLongFunction to be converted to a standard BiFunction
* @ return BiFunction that can throw checked Exceptions */
public static < T1 , T2 , R > BiFunction < T1 , T2 , R > softenBiFunction ( final CheckedBiFunction < T1 , T2 , R > fn ) { } } | return ( t1 , t2 ) -> { try { return fn . apply ( t1 , t2 ) ; } catch ( final Throwable e ) { throw throwSoftenedException ( e ) ; } } ; |
public class ValueFileIOHelper { /** * Write value array of bytes to a file .
* @ param file
* File
* @ param value
* ValueData
* @ return size of wrote content
* @ throws IOException
* if error occurs */
protected long writeByteArrayValue ( File file , ValueData value ) throws IOException { } } | OutputStream out = new FileOutputStream ( file ) ; try { byte [ ] data = value . getAsByteArray ( ) ; out . write ( data ) ; return data . length ; } finally { out . close ( ) ; } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.